@ngneat/helipopper 7.1.1 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/tippy.directive.mjs +472 -0
- package/{esm2020 → esm2022}/lib/tippy.service.mjs +4 -4
- package/esm2022/lib/utils.mjs +125 -0
- package/{fesm2020 → fesm2022}/ngneat-helipopper.mjs +107 -42
- package/fesm2022/ngneat-helipopper.mjs.map +1 -0
- package/lib/defaults.d.ts +1 -1
- package/lib/tippy.directive.d.ts +12 -2
- package/lib/tippy.types.d.ts +5 -5
- package/lib/utils.d.ts +1 -0
- package/package.json +9 -15
- package/esm2020/lib/tippy.directive.mjs +0 -424
- package/esm2020/lib/utils.mjs +0 -108
- package/fesm2015/ngneat-helipopper.mjs +0 -635
- package/fesm2015/ngneat-helipopper.mjs.map +0 -1
- package/fesm2020/ngneat-helipopper.mjs.map +0 -1
- /package/{esm2020 → esm2022}/lib/defaults.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/providers.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/tippy.types.mjs +0 -0
- /package/{esm2020 → esm2022}/ngneat-helipopper.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
|
@@ -1,635 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { ElementRef, InjectionToken, EventEmitter, Injector, PLATFORM_ID, Directive, Inject, Input, Output, Injectable } from '@angular/core';
|
|
3
|
-
import { isPlatformServer } from '@angular/common';
|
|
4
|
-
import tippy from 'tippy.js';
|
|
5
|
-
import { Observable, Subject, fromEvent, merge } from 'rxjs';
|
|
6
|
-
import { auditTime, map, switchMap, takeUntil, filter } from 'rxjs/operators';
|
|
7
|
-
import * as i1 from '@ngneat/overview';
|
|
8
|
-
import { isString as isString$1, isComponent, isTemplateRef } from '@ngneat/overview';
|
|
9
|
-
|
|
10
|
-
let supportsIntersectionObserver = false;
|
|
11
|
-
let supportsResizeObserver = false;
|
|
12
|
-
if (typeof window !== 'undefined') {
|
|
13
|
-
supportsIntersectionObserver = 'IntersectionObserver' in window;
|
|
14
|
-
supportsResizeObserver = 'ResizeObserver' in window;
|
|
15
|
-
}
|
|
16
|
-
function inView(host, options = {
|
|
17
|
-
root: null,
|
|
18
|
-
threshold: 0.3
|
|
19
|
-
}) {
|
|
20
|
-
const element = coerceElement(host);
|
|
21
|
-
return new Observable(subscriber => {
|
|
22
|
-
if (!supportsIntersectionObserver) {
|
|
23
|
-
subscriber.next();
|
|
24
|
-
subscriber.complete();
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const observer = new IntersectionObserver(entries => {
|
|
28
|
-
// Several changes may occur in the same tick, we want to check the latest entry state.
|
|
29
|
-
const entry = entries[entries.length - 1];
|
|
30
|
-
if (entry.isIntersecting) {
|
|
31
|
-
subscriber.next();
|
|
32
|
-
subscriber.complete();
|
|
33
|
-
}
|
|
34
|
-
}, options);
|
|
35
|
-
observer.observe(element);
|
|
36
|
-
return () => observer.disconnect();
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function isElementOverflow(host) {
|
|
40
|
-
// Don't access the `offsetWidth` multipe times since it triggers layout updates.
|
|
41
|
-
const hostOffsetWidth = host.offsetWidth;
|
|
42
|
-
return hostOffsetWidth > host.parentElement.offsetWidth || hostOffsetWidth < host.scrollWidth;
|
|
43
|
-
}
|
|
44
|
-
function overflowChanges(host) {
|
|
45
|
-
const element = coerceElement(host);
|
|
46
|
-
return dimensionsChanges(element).pipe(auditTime(150), map(() => isElementOverflow(element)));
|
|
47
|
-
}
|
|
48
|
-
function dimensionsChanges(target) {
|
|
49
|
-
return resizeObserverStrategy(target);
|
|
50
|
-
}
|
|
51
|
-
function resizeObserverStrategy(target) {
|
|
52
|
-
return new Observable(subscriber => {
|
|
53
|
-
if (!supportsResizeObserver) {
|
|
54
|
-
subscriber.next();
|
|
55
|
-
subscriber.complete();
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const observer = new ResizeObserver(() => subscriber.next(true));
|
|
59
|
-
observer.observe(target);
|
|
60
|
-
return () => observer.disconnect();
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function onlyTippyProps(allProps) {
|
|
64
|
-
const tippyProps = {};
|
|
65
|
-
const ownProps = [
|
|
66
|
-
'useTextContent',
|
|
67
|
-
'variations',
|
|
68
|
-
'useHostWidth',
|
|
69
|
-
'defaultVariation',
|
|
70
|
-
'beforeRender',
|
|
71
|
-
'isLazy',
|
|
72
|
-
'variation',
|
|
73
|
-
'isEnabled',
|
|
74
|
-
'className',
|
|
75
|
-
'onlyTextOverflow',
|
|
76
|
-
'data',
|
|
77
|
-
'content',
|
|
78
|
-
'context',
|
|
79
|
-
'hideOnEscape',
|
|
80
|
-
'customHost',
|
|
81
|
-
'injector',
|
|
82
|
-
'preserveView',
|
|
83
|
-
'vcr',
|
|
84
|
-
'popperWidth',
|
|
85
|
-
'zIndexGetter'
|
|
86
|
-
];
|
|
87
|
-
const overriddenMethods = ['onShow', 'onHidden', 'onCreate'];
|
|
88
|
-
Object.keys(allProps).forEach(prop => {
|
|
89
|
-
if (!ownProps.includes(prop) && !overriddenMethods.includes(prop)) {
|
|
90
|
-
tippyProps[prop] = allProps[prop];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return tippyProps;
|
|
94
|
-
}
|
|
95
|
-
function normalizeClassName(className) {
|
|
96
|
-
const classes = isString(className) ? className.split(' ') : className;
|
|
97
|
-
return classes.map(klass => klass === null || klass === void 0 ? void 0 : klass.trim()).filter(Boolean);
|
|
98
|
-
}
|
|
99
|
-
function coerceCssPixelValue(value) {
|
|
100
|
-
if (isNil(value)) {
|
|
101
|
-
return '';
|
|
102
|
-
}
|
|
103
|
-
return typeof value === 'string' ? value : `${value}px`;
|
|
104
|
-
}
|
|
105
|
-
function isString(value) {
|
|
106
|
-
return typeof value === 'string';
|
|
107
|
-
}
|
|
108
|
-
function isNil(value) {
|
|
109
|
-
return value === undefined || value === null;
|
|
110
|
-
}
|
|
111
|
-
function coerceElement(element) {
|
|
112
|
-
return element instanceof ElementRef ? element.nativeElement : element;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const TIPPY_CONFIG = new InjectionToken('Tippy config', {
|
|
116
|
-
providedIn: 'root',
|
|
117
|
-
factory() {
|
|
118
|
-
return {};
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const TIPPY_REF = new InjectionToken('TIPPY_REF');
|
|
122
|
-
|
|
123
|
-
class TippyDirective {
|
|
124
|
-
constructor(platformId, globalConfig, injector, viewService, vcr, zone, hostRef) {
|
|
125
|
-
this.platformId = platformId;
|
|
126
|
-
this.globalConfig = globalConfig;
|
|
127
|
-
this.injector = injector;
|
|
128
|
-
this.viewService = viewService;
|
|
129
|
-
this.vcr = vcr;
|
|
130
|
-
this.zone = zone;
|
|
131
|
-
this.hostRef = hostRef;
|
|
132
|
-
this.onlyTextOverflow = false;
|
|
133
|
-
this.useHostWidth = false;
|
|
134
|
-
this.hideOnEscape = false;
|
|
135
|
-
this.detectChangesComponent = true;
|
|
136
|
-
this.isVisible = false;
|
|
137
|
-
this.visible = new EventEmitter();
|
|
138
|
-
this.destroyed = new Subject();
|
|
139
|
-
this.enabled = true;
|
|
140
|
-
this.variationDefined = false;
|
|
141
|
-
/**
|
|
142
|
-
* We had use `visible` event emitter previously as a `takeUntil` subscriber in multiple places
|
|
143
|
-
* within the directive.
|
|
144
|
-
* This is for internal use only; thus we don't have to deal with the `visible` event emitter
|
|
145
|
-
* and trigger change detections only when the `visible` event is being listened outside
|
|
146
|
-
* in the template (`<button [tippy]="..." (visible)="..."></button>`).
|
|
147
|
-
*/
|
|
148
|
-
this.visibleInternal = new Subject();
|
|
149
|
-
}
|
|
150
|
-
ngOnChanges(changes) {
|
|
151
|
-
if (isPlatformServer(this.platformId))
|
|
152
|
-
return;
|
|
153
|
-
let props = Object.keys(changes).reduce((acc, change) => {
|
|
154
|
-
if (change === 'isVisible')
|
|
155
|
-
return acc;
|
|
156
|
-
acc[change] = changes[change].currentValue;
|
|
157
|
-
return acc;
|
|
158
|
-
}, {});
|
|
159
|
-
let variation;
|
|
160
|
-
if (isChanged('variation', changes)) {
|
|
161
|
-
variation = changes.variation.currentValue;
|
|
162
|
-
this.variationDefined = true;
|
|
163
|
-
}
|
|
164
|
-
else if (!this.variationDefined) {
|
|
165
|
-
variation = this.globalConfig.defaultVariation;
|
|
166
|
-
this.variationDefined = true;
|
|
167
|
-
}
|
|
168
|
-
if (variation) {
|
|
169
|
-
props = Object.assign(Object.assign({}, this.globalConfig.variations[variation]), props);
|
|
170
|
-
}
|
|
171
|
-
if (isChanged('isEnabled', changes)) {
|
|
172
|
-
this.enabled = changes.isEnabled.currentValue;
|
|
173
|
-
this.setStatus();
|
|
174
|
-
}
|
|
175
|
-
if (isChanged('isVisible', changes)) {
|
|
176
|
-
this.isVisible ? this.show() : this.hide();
|
|
177
|
-
}
|
|
178
|
-
this.setProps(Object.assign(Object.assign({}, this.props), props));
|
|
179
|
-
}
|
|
180
|
-
ngOnInit() {
|
|
181
|
-
if (this.useHostWidth) {
|
|
182
|
-
this.props.maxWidth = this.hostWidth;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
ngAfterViewInit() {
|
|
186
|
-
if (isPlatformServer(this.platformId))
|
|
187
|
-
return;
|
|
188
|
-
this.zone.runOutsideAngular(() => {
|
|
189
|
-
if (this.isLazy) {
|
|
190
|
-
if (this.onlyTextOverflow) {
|
|
191
|
-
inView(this.host)
|
|
192
|
-
.pipe(switchMap(() => overflowChanges(this.host)), takeUntil(this.destroyed))
|
|
193
|
-
.subscribe(isElementOverflow => {
|
|
194
|
-
this.checkOverflow(isElementOverflow);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
inView(this.host)
|
|
199
|
-
.pipe(takeUntil(this.destroyed))
|
|
200
|
-
.subscribe(() => {
|
|
201
|
-
this.createInstance();
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
else if (this.onlyTextOverflow) {
|
|
206
|
-
overflowChanges(this.host)
|
|
207
|
-
.pipe(takeUntil(this.destroyed))
|
|
208
|
-
.subscribe(isElementOverflow => {
|
|
209
|
-
this.checkOverflow(isElementOverflow);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
this.createInstance();
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
ngOnDestroy() {
|
|
218
|
-
var _a;
|
|
219
|
-
this.destroyed.next();
|
|
220
|
-
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
221
|
-
this.destroyView();
|
|
222
|
-
}
|
|
223
|
-
destroyView() {
|
|
224
|
-
var _a;
|
|
225
|
-
this.viewOptions$ = null;
|
|
226
|
-
(_a = this.viewRef) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
227
|
-
this.viewRef = null;
|
|
228
|
-
}
|
|
229
|
-
show() {
|
|
230
|
-
var _a;
|
|
231
|
-
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.show();
|
|
232
|
-
}
|
|
233
|
-
hide() {
|
|
234
|
-
var _a;
|
|
235
|
-
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.hide();
|
|
236
|
-
}
|
|
237
|
-
enable() {
|
|
238
|
-
var _a;
|
|
239
|
-
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.enable();
|
|
240
|
-
}
|
|
241
|
-
disable() {
|
|
242
|
-
var _a;
|
|
243
|
-
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.disable();
|
|
244
|
-
}
|
|
245
|
-
setProps(props) {
|
|
246
|
-
var _a;
|
|
247
|
-
this.props = props;
|
|
248
|
-
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.setProps(onlyTippyProps(props));
|
|
249
|
-
}
|
|
250
|
-
setStatus() {
|
|
251
|
-
var _a, _b;
|
|
252
|
-
this.enabled ? (_a = this.instance) === null || _a === void 0 ? void 0 : _a.enable() : (_b = this.instance) === null || _b === void 0 ? void 0 : _b.disable();
|
|
253
|
-
}
|
|
254
|
-
get host() {
|
|
255
|
-
return this.customHost || this.hostRef.nativeElement;
|
|
256
|
-
}
|
|
257
|
-
get hostWidth() {
|
|
258
|
-
return this.host.getBoundingClientRect().width;
|
|
259
|
-
}
|
|
260
|
-
createInstance() {
|
|
261
|
-
if (!this.content && !coerceBooleanInput(this.useTextContent)) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
this.zone.runOutsideAngular(() => {
|
|
265
|
-
this.instance = tippy(this.host, Object.assign(Object.assign(Object.assign(Object.assign({ allowHTML: true, appendTo: document.body }, (this.globalConfig.zIndexGetter ? { zIndex: this.globalConfig.zIndexGetter() } : {})), onlyTippyProps(this.globalConfig)), onlyTippyProps(this.props)), { onMount: instance => {
|
|
266
|
-
var _a, _b;
|
|
267
|
-
this.isVisible = true;
|
|
268
|
-
this.visibleInternal.next(this.isVisible);
|
|
269
|
-
if (this.visible.observed) {
|
|
270
|
-
this.zone.run(() => this.visible.next(this.isVisible));
|
|
271
|
-
}
|
|
272
|
-
this.useHostWidth && this.listenToHostResize();
|
|
273
|
-
(_b = (_a = this.globalConfig).onMount) === null || _b === void 0 ? void 0 : _b.call(_a, instance);
|
|
274
|
-
}, onCreate: instance => {
|
|
275
|
-
var _a, _b;
|
|
276
|
-
instance.popper.classList.add(`tippy-variation-${this.variation || this.globalConfig.defaultVariation}`);
|
|
277
|
-
if (this.className) {
|
|
278
|
-
for (const klass of normalizeClassName(this.className)) {
|
|
279
|
-
instance.popper.classList.add(klass);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
(_b = (_a = this.globalConfig).onCreate) === null || _b === void 0 ? void 0 : _b.call(_a, instance);
|
|
283
|
-
if (this.isVisible === true) {
|
|
284
|
-
instance.show();
|
|
285
|
-
}
|
|
286
|
-
}, onShow: instance => {
|
|
287
|
-
var _a, _b;
|
|
288
|
-
instance.reference.setAttribute('data-tippy-open', '');
|
|
289
|
-
this.zone.run(() => {
|
|
290
|
-
const content = this.resolveContent(instance);
|
|
291
|
-
if (isString$1(content)) {
|
|
292
|
-
instance.setProps({ allowHTML: false });
|
|
293
|
-
if (!(content === null || content === void 0 ? void 0 : content.trim())) {
|
|
294
|
-
this.disable();
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
this.enable();
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
instance.setContent(content);
|
|
301
|
-
this.hideOnEscape && this.handleEscapeButton();
|
|
302
|
-
});
|
|
303
|
-
if (this.useHostWidth) {
|
|
304
|
-
this.setInstanceWidth(instance, this.hostWidth);
|
|
305
|
-
}
|
|
306
|
-
else if (this.popperWidth) {
|
|
307
|
-
this.setInstanceWidth(instance, this.popperWidth);
|
|
308
|
-
}
|
|
309
|
-
(_b = (_a = this.globalConfig).onShow) === null || _b === void 0 ? void 0 : _b.call(_a, instance);
|
|
310
|
-
}, onHide(instance) {
|
|
311
|
-
instance.reference.removeAttribute('data-tippy-open');
|
|
312
|
-
}, onHidden: instance => {
|
|
313
|
-
var _a, _b;
|
|
314
|
-
this.destroyView();
|
|
315
|
-
this.isVisible = false;
|
|
316
|
-
this.visibleInternal.next(this.isVisible);
|
|
317
|
-
if (this.visible.observed) {
|
|
318
|
-
this.zone.run(() => this.visible.next(this.isVisible));
|
|
319
|
-
}
|
|
320
|
-
(_b = (_a = this.globalConfig).onHidden) === null || _b === void 0 ? void 0 : _b.call(_a, instance);
|
|
321
|
-
} }));
|
|
322
|
-
this.setStatus();
|
|
323
|
-
this.setProps(this.props);
|
|
324
|
-
this.variation === 'contextMenu' && this.handleContextMenu();
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
resolveContent(instance) {
|
|
328
|
-
if (!this.viewOptions$ && !isString$1(this.content)) {
|
|
329
|
-
if (isComponent(this.content)) {
|
|
330
|
-
this.instance.data = this.data;
|
|
331
|
-
this.viewOptions$ = {
|
|
332
|
-
injector: Injector.create({
|
|
333
|
-
providers: [
|
|
334
|
-
{
|
|
335
|
-
provide: TIPPY_REF,
|
|
336
|
-
useValue: this.instance
|
|
337
|
-
}
|
|
338
|
-
],
|
|
339
|
-
parent: this.injector
|
|
340
|
-
})
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
else if (isTemplateRef(this.content)) {
|
|
344
|
-
this.viewOptions$ = {
|
|
345
|
-
context: {
|
|
346
|
-
$implicit: this.hide.bind(this),
|
|
347
|
-
data: this.data
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
this.viewRef = this.viewService.createView(this.content, Object.assign({ vcr: this.vcr }, this.viewOptions$));
|
|
353
|
-
// We need to call detectChanges for onPush components to update the content
|
|
354
|
-
if (this.detectChangesComponent && isComponent(this.content)) {
|
|
355
|
-
this.viewRef.detectChanges();
|
|
356
|
-
}
|
|
357
|
-
let content = this.viewRef.getElement();
|
|
358
|
-
if (coerceBooleanInput(this.useTextContent)) {
|
|
359
|
-
content = instance.reference.textContent;
|
|
360
|
-
}
|
|
361
|
-
if (isString$1(content) && this.globalConfig.beforeRender) {
|
|
362
|
-
content = this.globalConfig.beforeRender(content);
|
|
363
|
-
}
|
|
364
|
-
return content;
|
|
365
|
-
}
|
|
366
|
-
handleContextMenu() {
|
|
367
|
-
fromEvent(this.host, 'contextmenu')
|
|
368
|
-
.pipe(takeUntil(this.destroyed))
|
|
369
|
-
.subscribe((event) => {
|
|
370
|
-
event.preventDefault();
|
|
371
|
-
this.instance.setProps({
|
|
372
|
-
getReferenceClientRect: () => ({
|
|
373
|
-
width: 0,
|
|
374
|
-
height: 0,
|
|
375
|
-
top: event.clientY,
|
|
376
|
-
bottom: event.clientY,
|
|
377
|
-
left: event.clientX,
|
|
378
|
-
right: event.clientX
|
|
379
|
-
})
|
|
380
|
-
});
|
|
381
|
-
this.instance.show();
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
handleEscapeButton() {
|
|
385
|
-
this.zone.runOutsideAngular(() => {
|
|
386
|
-
fromEvent(document.body, 'keydown')
|
|
387
|
-
.pipe(filter(({ code }) => code === 'Escape'), takeUntil(merge(this.destroyed, this.visibleInternal.pipe(filter(v => !v)))))
|
|
388
|
-
.subscribe(() => this.hide());
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
checkOverflow(isElementOverflow) {
|
|
392
|
-
var _a;
|
|
393
|
-
if (isElementOverflow) {
|
|
394
|
-
if (!this.instance) {
|
|
395
|
-
this.createInstance();
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
this.instance.enable();
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.disable();
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
listenToHostResize() {
|
|
406
|
-
dimensionsChanges(this.host)
|
|
407
|
-
.pipe(takeUntil(merge(this.destroyed, this.visibleInternal)))
|
|
408
|
-
.subscribe(() => {
|
|
409
|
-
this.setInstanceWidth(this.instance, this.hostWidth);
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
setInstanceWidth(instance, width) {
|
|
413
|
-
const inPixels = coerceCssPixelValue(width);
|
|
414
|
-
instance.popper.style.width = inPixels;
|
|
415
|
-
instance.popper.style.maxWidth = inPixels;
|
|
416
|
-
instance.popper.firstElementChild.style.maxWidth = inPixels;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
TippyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TippyDirective, deps: [{ token: PLATFORM_ID }, { token: TIPPY_CONFIG }, { token: i0.Injector }, { token: i1.ViewService }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
420
|
-
TippyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: TippyDirective, isStandalone: true, selector: "[tp]", inputs: { content: ["tp", "content"], appendTo: ["tpAppendTo", "appendTo"], delay: ["tpDelay", "delay"], duration: ["tpDuration", "duration"], hideOnClick: ["tpHideOnClick", "hideOnClick"], interactive: ["tpInteractive", "interactive"], interactiveBorder: ["tpInteractiveBorder", "interactiveBorder"], maxWidth: ["tpMaxWidth", "maxWidth"], offset: ["tpOffset", "offset"], placement: ["tpPlacement", "placement"], popperOptions: ["tpPopperOptions", "popperOptions"], showOnCreate: ["tpShowOnCreate", "showOnCreate"], trigger: ["tpTrigger", "trigger"], triggerTarget: ["tpTriggerTarget", "triggerTarget"], zIndex: ["tpZIndex", "zIndex"], animation: ["tpAnimation", "animation"], useTextContent: ["tpUseTextContent", "useTextContent"], isLazy: ["tpIsLazy", "isLazy"], variation: ["tpVariation", "variation"], isEnabled: ["tpIsEnabled", "isEnabled"], className: ["tpClassName", "className"], onlyTextOverflow: ["tpOnlyTextOverflow", "onlyTextOverflow"], data: ["tpData", "data"], useHostWidth: ["tpUseHostWidth", "useHostWidth"], hideOnEscape: ["tpHideOnEscape", "hideOnEscape"], detectChangesComponent: ["tpDetectChangesComponent", "detectChangesComponent"], popperWidth: ["tpPopperWidth", "popperWidth"], customHost: ["tpHost", "customHost"], isVisible: ["tpIsVisible", "isVisible"] }, outputs: { visible: "tpVisible" }, exportAs: ["tippy"], usesOnChanges: true, ngImport: i0 });
|
|
421
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TippyDirective, decorators: [{
|
|
422
|
-
type: Directive,
|
|
423
|
-
args: [{
|
|
424
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
425
|
-
selector: '[tp]',
|
|
426
|
-
exportAs: 'tippy',
|
|
427
|
-
standalone: true
|
|
428
|
-
}]
|
|
429
|
-
}], ctorParameters: function () {
|
|
430
|
-
return [{ type: undefined, decorators: [{
|
|
431
|
-
type: Inject,
|
|
432
|
-
args: [PLATFORM_ID]
|
|
433
|
-
}] }, { type: undefined, decorators: [{
|
|
434
|
-
type: Inject,
|
|
435
|
-
args: [TIPPY_CONFIG]
|
|
436
|
-
}] }, { type: i0.Injector }, { type: i1.ViewService }, { type: i0.ViewContainerRef }, { type: i0.NgZone }, { type: i0.ElementRef }];
|
|
437
|
-
}, propDecorators: { content: [{
|
|
438
|
-
type: Input,
|
|
439
|
-
args: ['tp']
|
|
440
|
-
}], appendTo: [{
|
|
441
|
-
type: Input,
|
|
442
|
-
args: ['tpAppendTo']
|
|
443
|
-
}], delay: [{
|
|
444
|
-
type: Input,
|
|
445
|
-
args: ['tpDelay']
|
|
446
|
-
}], duration: [{
|
|
447
|
-
type: Input,
|
|
448
|
-
args: ['tpDuration']
|
|
449
|
-
}], hideOnClick: [{
|
|
450
|
-
type: Input,
|
|
451
|
-
args: ['tpHideOnClick']
|
|
452
|
-
}], interactive: [{
|
|
453
|
-
type: Input,
|
|
454
|
-
args: ['tpInteractive']
|
|
455
|
-
}], interactiveBorder: [{
|
|
456
|
-
type: Input,
|
|
457
|
-
args: ['tpInteractiveBorder']
|
|
458
|
-
}], maxWidth: [{
|
|
459
|
-
type: Input,
|
|
460
|
-
args: ['tpMaxWidth']
|
|
461
|
-
}], offset: [{
|
|
462
|
-
type: Input,
|
|
463
|
-
args: ['tpOffset']
|
|
464
|
-
}], placement: [{
|
|
465
|
-
type: Input,
|
|
466
|
-
args: ['tpPlacement']
|
|
467
|
-
}], popperOptions: [{
|
|
468
|
-
type: Input,
|
|
469
|
-
args: ['tpPopperOptions']
|
|
470
|
-
}], showOnCreate: [{
|
|
471
|
-
type: Input,
|
|
472
|
-
args: ['tpShowOnCreate']
|
|
473
|
-
}], trigger: [{
|
|
474
|
-
type: Input,
|
|
475
|
-
args: ['tpTrigger']
|
|
476
|
-
}], triggerTarget: [{
|
|
477
|
-
type: Input,
|
|
478
|
-
args: ['tpTriggerTarget']
|
|
479
|
-
}], zIndex: [{
|
|
480
|
-
type: Input,
|
|
481
|
-
args: ['tpZIndex']
|
|
482
|
-
}], animation: [{
|
|
483
|
-
type: Input,
|
|
484
|
-
args: ['tpAnimation']
|
|
485
|
-
}], useTextContent: [{
|
|
486
|
-
type: Input,
|
|
487
|
-
args: ['tpUseTextContent']
|
|
488
|
-
}], isLazy: [{
|
|
489
|
-
type: Input,
|
|
490
|
-
args: ['tpIsLazy']
|
|
491
|
-
}], variation: [{
|
|
492
|
-
type: Input,
|
|
493
|
-
args: ['tpVariation']
|
|
494
|
-
}], isEnabled: [{
|
|
495
|
-
type: Input,
|
|
496
|
-
args: ['tpIsEnabled']
|
|
497
|
-
}], className: [{
|
|
498
|
-
type: Input,
|
|
499
|
-
args: ['tpClassName']
|
|
500
|
-
}], onlyTextOverflow: [{
|
|
501
|
-
type: Input,
|
|
502
|
-
args: ['tpOnlyTextOverflow']
|
|
503
|
-
}], data: [{
|
|
504
|
-
type: Input,
|
|
505
|
-
args: ['tpData']
|
|
506
|
-
}], useHostWidth: [{
|
|
507
|
-
type: Input,
|
|
508
|
-
args: ['tpUseHostWidth']
|
|
509
|
-
}], hideOnEscape: [{
|
|
510
|
-
type: Input,
|
|
511
|
-
args: ['tpHideOnEscape']
|
|
512
|
-
}], detectChangesComponent: [{
|
|
513
|
-
type: Input,
|
|
514
|
-
args: ['tpDetectChangesComponent']
|
|
515
|
-
}], popperWidth: [{
|
|
516
|
-
type: Input,
|
|
517
|
-
args: ['tpPopperWidth']
|
|
518
|
-
}], customHost: [{
|
|
519
|
-
type: Input,
|
|
520
|
-
args: ['tpHost']
|
|
521
|
-
}], isVisible: [{
|
|
522
|
-
type: Input,
|
|
523
|
-
args: ['tpIsVisible']
|
|
524
|
-
}], visible: [{
|
|
525
|
-
type: Output,
|
|
526
|
-
args: ['tpVisible']
|
|
527
|
-
}] } });
|
|
528
|
-
function isChanged(key, changes) {
|
|
529
|
-
return key in changes;
|
|
530
|
-
}
|
|
531
|
-
function coerceBooleanInput(value) {
|
|
532
|
-
return value != null && `${value}` !== 'false';
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
const tooltipVariation = {
|
|
536
|
-
theme: null,
|
|
537
|
-
arrow: false,
|
|
538
|
-
animation: 'scale',
|
|
539
|
-
trigger: 'mouseenter',
|
|
540
|
-
offset: [0, 5]
|
|
541
|
-
};
|
|
542
|
-
const popperVariation = {
|
|
543
|
-
theme: 'light',
|
|
544
|
-
arrow: true,
|
|
545
|
-
offset: [0, 10],
|
|
546
|
-
animation: null,
|
|
547
|
-
trigger: 'click',
|
|
548
|
-
interactive: true
|
|
549
|
-
};
|
|
550
|
-
function withContextMenuVariation(baseVariation) {
|
|
551
|
-
return Object.assign(Object.assign({}, baseVariation), { placement: 'right-start', trigger: 'manual', arrow: false, offset: [0, 0] });
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
class TippyService {
|
|
555
|
-
constructor(globalConfig, view, injector) {
|
|
556
|
-
this.globalConfig = globalConfig;
|
|
557
|
-
this.view = view;
|
|
558
|
-
this.injector = injector;
|
|
559
|
-
}
|
|
560
|
-
create(host, content, options = {}) {
|
|
561
|
-
const variation = options.variation || this.globalConfig.defaultVariation;
|
|
562
|
-
const config = Object.assign(Object.assign(Object.assign(Object.assign({ onShow: instance => {
|
|
563
|
-
var _a;
|
|
564
|
-
host.setAttribute('data-tippy-open', '');
|
|
565
|
-
if (!instance.$viewOptions) {
|
|
566
|
-
instance.$viewOptions = {};
|
|
567
|
-
if (isTemplateRef(content)) {
|
|
568
|
-
instance.$viewOptions.context = Object.assign({ $implicit: instance.hide.bind(instance) }, options.context);
|
|
569
|
-
}
|
|
570
|
-
else if (isComponent(content)) {
|
|
571
|
-
instance.context = options.context;
|
|
572
|
-
instance.data = options.data;
|
|
573
|
-
instance.$viewOptions.injector = Injector.create({
|
|
574
|
-
providers: [
|
|
575
|
-
{
|
|
576
|
-
provide: TIPPY_REF,
|
|
577
|
-
useValue: instance
|
|
578
|
-
}
|
|
579
|
-
],
|
|
580
|
-
parent: options.injector || this.injector
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
if (!instance.view) {
|
|
585
|
-
instance.view = this.view.createView(content, Object.assign(Object.assign({}, options), instance.$viewOptions));
|
|
586
|
-
}
|
|
587
|
-
instance.setContent(instance.view.getElement());
|
|
588
|
-
(_a = options === null || options === void 0 ? void 0 : options.onShow) === null || _a === void 0 ? void 0 : _a.call(options, instance);
|
|
589
|
-
}, onHidden: instance => {
|
|
590
|
-
var _a;
|
|
591
|
-
host.removeAttribute('data-tippy-open');
|
|
592
|
-
if (!options.preserveView) {
|
|
593
|
-
instance.view.destroy();
|
|
594
|
-
instance.view = null;
|
|
595
|
-
}
|
|
596
|
-
(_a = options === null || options === void 0 ? void 0 : options.onHidden) === null || _a === void 0 ? void 0 : _a.call(options, instance);
|
|
597
|
-
} }, onlyTippyProps(this.globalConfig)), this.globalConfig.variations[variation]), onlyTippyProps(options)), { onCreate: instance => {
|
|
598
|
-
var _a, _b, _c;
|
|
599
|
-
instance.popper.classList.add(`tippy-variation-${variation}`);
|
|
600
|
-
if (options.className) {
|
|
601
|
-
for (const klass of normalizeClassName(options.className)) {
|
|
602
|
-
instance.popper.classList.add(klass);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
(_b = (_a = this.globalConfig).onCreate) === null || _b === void 0 ? void 0 : _b.call(_a, instance);
|
|
606
|
-
(_c = options.onCreate) === null || _c === void 0 ? void 0 : _c.call(options, instance);
|
|
607
|
-
} });
|
|
608
|
-
return tippy(host, config);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
TippyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TippyService, deps: [{ token: TIPPY_CONFIG }, { token: i1.ViewService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
612
|
-
TippyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TippyService, providedIn: 'root' });
|
|
613
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TippyService, decorators: [{
|
|
614
|
-
type: Injectable,
|
|
615
|
-
args: [{ providedIn: 'root' }]
|
|
616
|
-
}], ctorParameters: function () {
|
|
617
|
-
return [{ type: undefined, decorators: [{
|
|
618
|
-
type: Inject,
|
|
619
|
-
args: [TIPPY_CONFIG]
|
|
620
|
-
}] }, { type: i1.ViewService }, { type: i0.Injector }];
|
|
621
|
-
} });
|
|
622
|
-
|
|
623
|
-
function provideTippyConfig(config = {}) {
|
|
624
|
-
return {
|
|
625
|
-
provide: TIPPY_CONFIG,
|
|
626
|
-
useValue: config
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* Generated bundle index. Do not edit.
|
|
632
|
-
*/
|
|
633
|
-
|
|
634
|
-
export { TIPPY_CONFIG, TIPPY_REF, TippyDirective, TippyService, inView, overflowChanges, popperVariation, provideTippyConfig, tooltipVariation, withContextMenuVariation };
|
|
635
|
-
//# sourceMappingURL=ngneat-helipopper.mjs.map
|