@acorex/components 21.0.0-next52 → 21.0.1-next.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/code-editor/index.d.ts +5 -1
- package/data-list/index.d.ts +1 -1
- package/decorators/index.d.ts +5 -1
- package/fesm2022/acorex-components-code-editor.mjs +17 -6
- package/fesm2022/acorex-components-code-editor.mjs.map +1 -1
- package/fesm2022/acorex-components-data-list.mjs +11 -22
- package/fesm2022/acorex-components-data-list.mjs.map +1 -1
- package/fesm2022/acorex-components-data-pager.mjs +0 -1
- package/fesm2022/acorex-components-data-pager.mjs.map +1 -1
- package/fesm2022/acorex-components-data-table.mjs +12 -5
- package/fesm2022/acorex-components-data-table.mjs.map +1 -1
- package/fesm2022/acorex-components-decorators.mjs +22 -3
- package/fesm2022/acorex-components-decorators.mjs.map +1 -1
- package/fesm2022/acorex-components-form.mjs +6 -8
- package/fesm2022/acorex-components-form.mjs.map +1 -1
- package/fesm2022/acorex-components-json-viewer.mjs +11 -5
- package/fesm2022/acorex-components-json-viewer.mjs.map +1 -1
- package/fesm2022/acorex-components-media-viewer.mjs +18 -24
- package/fesm2022/acorex-components-media-viewer.mjs.map +1 -1
- package/fesm2022/acorex-components-menu.mjs +26 -5
- package/fesm2022/acorex-components-menu.mjs.map +1 -1
- package/fesm2022/{acorex-components-modal-acorex-components-modal-iYSPzoLn.mjs → acorex-components-modal-acorex-components-modal-BNmjgw73.mjs} +27 -3
- package/fesm2022/acorex-components-modal-acorex-components-modal-BNmjgw73.mjs.map +1 -0
- package/fesm2022/{acorex-components-modal-modal-content.component-sZWKhYM-.mjs → acorex-components-modal-modal-content.component-B02583hv.mjs} +2 -2
- package/fesm2022/{acorex-components-modal-modal-content.component-sZWKhYM-.mjs.map → acorex-components-modal-modal-content.component-B02583hv.mjs.map} +1 -1
- package/fesm2022/acorex-components-modal.mjs +1 -1
- package/fesm2022/acorex-components-number-box.mjs +4 -5
- package/fesm2022/acorex-components-number-box.mjs.map +1 -1
- package/fesm2022/acorex-components-pdf-reader.mjs +2 -2
- package/fesm2022/acorex-components-pdf-reader.mjs.map +1 -1
- package/fesm2022/acorex-components-phone-box.mjs +12 -3
- package/fesm2022/acorex-components-phone-box.mjs.map +1 -1
- package/fesm2022/acorex-components-popover.mjs +136 -175
- package/fesm2022/acorex-components-popover.mjs.map +1 -1
- package/fesm2022/acorex-components-popup.mjs +308 -105
- package/fesm2022/acorex-components-popup.mjs.map +1 -1
- package/fesm2022/acorex-components-side-menu.mjs +2 -2
- package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-tree-view.mjs +68 -7
- package/fesm2022/acorex-components-tree-view.mjs.map +1 -1
- package/fesm2022/acorex-components-wysiwyg.mjs +5 -5
- package/fesm2022/acorex-components-wysiwyg.mjs.map +1 -1
- package/json-viewer/index.d.ts +3 -2
- package/media-viewer/index.d.ts +3 -4
- package/menu/index.d.ts +4 -0
- package/modal/index.d.ts +7 -0
- package/number-box/index.d.ts +1 -1
- package/package.json +7 -7
- package/phone-box/index.d.ts +4 -1
- package/popover/index.d.ts +20 -27
- package/popup/index.d.ts +103 -27
- package/tree-view/index.d.ts +26 -4
- package/wysiwyg/index.d.ts +0 -1
- package/fesm2022/acorex-components-modal-acorex-components-modal-iYSPzoLn.mjs.map +0 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { MXBaseComponent, convertToPlacement, AXFocusableComponent, AXComponent } from '@acorex/cdk/common';
|
|
2
|
+
import { AXOverlayService } from '@acorex/cdk/overlay';
|
|
2
3
|
import { AXPlatform } from '@acorex/core/platform';
|
|
3
|
-
import { AXHtmlUtil } from '@acorex/core/utils';
|
|
4
|
-
import { Overlay } from '@angular/cdk/overlay';
|
|
5
|
-
import { TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
|
|
6
4
|
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
|
7
5
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { inject, DOCUMENT, PLATFORM_ID,
|
|
6
|
+
import { inject, DOCUMENT, PLATFORM_ID, input, EventEmitter, ElementRef, TemplateRef, Output, Input, ViewChild, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
|
|
9
7
|
import { Subject, fromEvent, delay, debounceTime } from 'rxjs';
|
|
10
8
|
|
|
11
9
|
/**
|
|
@@ -15,45 +13,42 @@ import { Subject, fromEvent, delay, debounceTime } from 'rxjs';
|
|
|
15
13
|
class AXPopoverComponent extends MXBaseComponent {
|
|
16
14
|
constructor() {
|
|
17
15
|
super(...arguments);
|
|
18
|
-
this
|
|
16
|
+
this.platform = inject(AXPlatform);
|
|
19
17
|
this.document = inject(DOCUMENT);
|
|
20
18
|
this.platformID = inject(PLATFORM_ID);
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
19
|
+
this.overlayService = inject(AXOverlayService);
|
|
20
|
+
this.onKeyDownHandler = null;
|
|
23
21
|
/** @ignore */
|
|
24
|
-
this.
|
|
22
|
+
this._overlayRef = null;
|
|
25
23
|
/** @ignore */
|
|
26
|
-
this.
|
|
27
|
-
/** @ignore */
|
|
28
|
-
this._isMouseOverButton = false;
|
|
29
|
-
/** @ignore */
|
|
30
|
-
this._isMouseOverTooltip = false;
|
|
24
|
+
this._lastActiveElement = null;
|
|
31
25
|
/** @ignore */
|
|
32
26
|
this._targetEvents = {};
|
|
33
27
|
/** @ignore */
|
|
34
|
-
this.
|
|
28
|
+
this._outsideClickHandler = null;
|
|
29
|
+
/** @ignore */
|
|
30
|
+
this.resizeObserver = null;
|
|
35
31
|
/** @ignore */
|
|
36
32
|
this.resize$ = new Subject();
|
|
37
|
-
//
|
|
38
33
|
/** @ignore */
|
|
39
34
|
this._disabled = false;
|
|
40
|
-
this.width = input('
|
|
35
|
+
this.width = input('fit-content', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
41
36
|
/** @ignore */
|
|
42
37
|
this._offsetX = 0;
|
|
43
|
-
//
|
|
44
38
|
/** @ignore */
|
|
45
39
|
this._offsetY = 0;
|
|
46
40
|
/** @ignore */
|
|
47
|
-
this.
|
|
41
|
+
this._defaultPlacements = convertToPlacement('bottom-start');
|
|
48
42
|
/** @ignore */
|
|
49
|
-
this._placements = [...this.
|
|
43
|
+
this._placements = [...this._defaultPlacements];
|
|
50
44
|
/** @ignore */
|
|
51
45
|
this._placement = this._placements;
|
|
52
46
|
/** @ignore */
|
|
47
|
+
this._componentRef = null;
|
|
48
|
+
/** @ignore */
|
|
53
49
|
this._openOn = 'toggle';
|
|
54
50
|
/** @ignore */
|
|
55
51
|
this._closeOn = 'clickOut';
|
|
56
|
-
//
|
|
57
52
|
/**
|
|
58
53
|
* Determines if a backdrop should be displayed behind the popover.
|
|
59
54
|
*/
|
|
@@ -70,7 +65,6 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
70
65
|
* Enables or disables adaptivity.
|
|
71
66
|
*/
|
|
72
67
|
this.adaptivityEnabled = false;
|
|
73
|
-
//
|
|
74
68
|
/**
|
|
75
69
|
* Emits when the component is opened.
|
|
76
70
|
* @event
|
|
@@ -82,7 +76,6 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
82
76
|
*/
|
|
83
77
|
this.onClosed = new EventEmitter();
|
|
84
78
|
}
|
|
85
|
-
#platform;
|
|
86
79
|
/**
|
|
87
80
|
* Gets or sets whether the popover is disabled.
|
|
88
81
|
* When disabled, the popover will not open and will close if already open.
|
|
@@ -149,7 +142,6 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
149
142
|
this._target = v.nativeElement;
|
|
150
143
|
else if (typeof v?.getHostElement == 'function')
|
|
151
144
|
this._target = v.getHostElement();
|
|
152
|
-
//
|
|
153
145
|
this.bindTargetEvents();
|
|
154
146
|
}
|
|
155
147
|
/**
|
|
@@ -167,9 +159,11 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
167
159
|
value: v,
|
|
168
160
|
afterCallback: (o, n) => {
|
|
169
161
|
const converted = convertToPlacement(n);
|
|
170
|
-
this._placements = converted.length ? converted : this.
|
|
162
|
+
this._placements = converted.length ? converted : this._defaultPlacements;
|
|
171
163
|
this.updateOffset();
|
|
172
|
-
this.
|
|
164
|
+
if (this._overlayRef) {
|
|
165
|
+
this._overlayRef.updatePosition();
|
|
166
|
+
}
|
|
173
167
|
},
|
|
174
168
|
});
|
|
175
169
|
}
|
|
@@ -205,7 +199,6 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
205
199
|
}
|
|
206
200
|
/**
|
|
207
201
|
* Sets the trigger for closing the popover and rebinds target events.
|
|
208
|
-
* @param v
|
|
209
202
|
*/
|
|
210
203
|
set closeOn(v) {
|
|
211
204
|
this.setOption({
|
|
@@ -230,25 +223,12 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
230
223
|
htmlElement: this.getHostElement(),
|
|
231
224
|
});
|
|
232
225
|
}
|
|
233
|
-
//
|
|
234
|
-
/** @ignore */
|
|
235
|
-
_handleMouseEnter(e) {
|
|
236
|
-
this._isMouseOverTooltip = true;
|
|
237
|
-
}
|
|
238
|
-
/** @ignore */
|
|
239
|
-
_handleMouseLeave(e) {
|
|
240
|
-
this._isMouseOverTooltip = false;
|
|
241
|
-
setTimeout(() => {
|
|
242
|
-
if (!this._isMouseOverButton && this.closeOn == 'leave') {
|
|
243
|
-
this.close();
|
|
244
|
-
}
|
|
245
|
-
}, 250);
|
|
246
|
-
}
|
|
247
226
|
/** @ignore */
|
|
248
227
|
removeTargetEvents() {
|
|
249
228
|
Object.entries(this._targetEvents).forEach((e) => {
|
|
250
|
-
e[1]
|
|
229
|
+
e[1]?.unsubscribe();
|
|
251
230
|
});
|
|
231
|
+
this._targetEvents = {};
|
|
252
232
|
}
|
|
253
233
|
/** @ignore */
|
|
254
234
|
bindTargetEvents() {
|
|
@@ -257,84 +237,69 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
257
237
|
return;
|
|
258
238
|
const targetMouseEnter$ = fromEvent(this._target, 'mouseenter');
|
|
259
239
|
const targetMouseLeave$ = fromEvent(this._target, 'mouseleave');
|
|
260
|
-
if (this.openOn
|
|
240
|
+
if (this.openOn === 'hover') {
|
|
261
241
|
this._targetEvents.mouseenter = targetMouseEnter$.pipe(delay(this.openAfter)).subscribe(() => {
|
|
262
|
-
this._isMouseOverButton = true;
|
|
263
242
|
this.open();
|
|
264
243
|
});
|
|
265
244
|
}
|
|
266
|
-
if (this.closeOn
|
|
245
|
+
if (this.closeOn === 'leave') {
|
|
267
246
|
this._targetEvents.mouseleave = targetMouseLeave$.pipe(delay(this.closeAfter)).subscribe(() => {
|
|
268
|
-
this.
|
|
269
|
-
if (!this._isMouseOverTooltip) {
|
|
270
|
-
this.close();
|
|
271
|
-
}
|
|
247
|
+
this.close();
|
|
272
248
|
});
|
|
273
249
|
}
|
|
274
250
|
if (this.openOn === 'click' || this.openOn === 'toggle') {
|
|
275
251
|
const click$ = fromEvent(this._target, 'click');
|
|
276
|
-
this._targetEvents.click = click$.subscribe((
|
|
277
|
-
this.openOn
|
|
252
|
+
this._targetEvents.click = click$.subscribe(() => {
|
|
253
|
+
this.openOn === 'toggle' ? this.toggle() : this.open();
|
|
278
254
|
});
|
|
279
255
|
}
|
|
280
256
|
}
|
|
281
|
-
//
|
|
282
257
|
/** @ignore */
|
|
283
258
|
bindOverlayEvents() {
|
|
284
|
-
this.
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
this._overlayRef?.overlayElement?.addEventListener('mouseleave', this._handleMouseLeave.bind(this));
|
|
292
|
-
}
|
|
293
|
-
//
|
|
294
|
-
this._overlayEvents.outside = this._overlayRef._outsidePointerEvents.subscribe((e) => {
|
|
259
|
+
const overlayElement = this._overlayRef?.overlayElement;
|
|
260
|
+
if (!overlayElement)
|
|
261
|
+
return;
|
|
262
|
+
overlayElement.style.pointerEvents = 'none';
|
|
263
|
+
// Outside click handler
|
|
264
|
+
if (this.closeOn === 'clickOut') {
|
|
265
|
+
this._outsideClickHandler = (e) => {
|
|
295
266
|
const el = e.target;
|
|
296
|
-
if (this.
|
|
297
|
-
this.isOpen &&
|
|
298
|
-
!this._target.contains(el) &&
|
|
299
|
-
!this._overlayRef?.overlayElement?.contains(el)) {
|
|
267
|
+
if (this.isOpen && !this._target?.contains(el) && !overlayElement?.contains(el)) {
|
|
300
268
|
this.close();
|
|
301
269
|
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
if (el?.closest &&
|
|
313
|
-
!el.closest('.ax-overlay-pane') &&
|
|
314
|
-
!this._target.contains(el) &&
|
|
315
|
-
!this._overlayRef?.overlayElement?.contains(el)) {
|
|
316
|
-
this.close();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
});
|
|
270
|
+
};
|
|
271
|
+
this.document.addEventListener('mousedown', this._outsideClickHandler);
|
|
272
|
+
}
|
|
273
|
+
// Resize observer
|
|
274
|
+
this.initializeResizeObserver();
|
|
275
|
+
setTimeout(() => {
|
|
276
|
+
overlayElement.style.pointerEvents = 'auto';
|
|
277
|
+
}, this.openAfter);
|
|
321
278
|
}
|
|
322
279
|
/** @ignore */
|
|
323
280
|
removeOverlayEvents() {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
281
|
+
if (this._outsideClickHandler) {
|
|
282
|
+
this.document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
283
|
+
this._outsideClickHandler = null;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/** @ignore */
|
|
287
|
+
handleOverlayDisposed() {
|
|
288
|
+
// Called when overlay is disposed externally (e.g., by scroll)
|
|
289
|
+
this.disconnectResizeObserver();
|
|
290
|
+
this.removeOverlayEvents();
|
|
291
|
+
this.removeKeyDownListener();
|
|
292
|
+
this._overlayRef = null;
|
|
293
|
+
this._componentRef = null;
|
|
294
|
+
this.restoreFocus();
|
|
295
|
+
this._emitOnClosedEvent();
|
|
329
296
|
}
|
|
330
|
-
//
|
|
331
297
|
/**
|
|
332
298
|
* Toggles the component's open state.
|
|
333
299
|
*/
|
|
334
300
|
toggle() {
|
|
335
301
|
this.isOpen ? this.close() : this.open();
|
|
336
302
|
}
|
|
337
|
-
//
|
|
338
303
|
/**
|
|
339
304
|
* Closes the component if it's open, detaches the overlay, restores focus, and emits the closed event.
|
|
340
305
|
*/
|
|
@@ -343,29 +308,45 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
343
308
|
return;
|
|
344
309
|
}
|
|
345
310
|
this.disconnectResizeObserver();
|
|
346
|
-
this.
|
|
311
|
+
this.removeOverlayEvents();
|
|
312
|
+
this.removeKeyDownListener();
|
|
313
|
+
if (this._overlayRef) {
|
|
314
|
+
this._overlayRef.dispose();
|
|
315
|
+
this._overlayRef = null;
|
|
316
|
+
}
|
|
317
|
+
this._componentRef = null;
|
|
347
318
|
this.restoreFocus();
|
|
348
319
|
this._emitOnClosedEvent();
|
|
349
|
-
this.onKeyDownListenerFn();
|
|
350
320
|
}
|
|
351
|
-
//
|
|
352
321
|
/**
|
|
353
322
|
* Opens the component if it's not already open, saves focus, opens the overlay, and emits the opened event.
|
|
354
323
|
*/
|
|
355
|
-
open() {
|
|
324
|
+
async open() {
|
|
356
325
|
if (this.isOpen || this.disabled) {
|
|
357
326
|
return;
|
|
358
327
|
}
|
|
328
|
+
this.addKeyDownListener();
|
|
329
|
+
this.saveFocus();
|
|
330
|
+
await this.openOverlayInternal();
|
|
331
|
+
this._emitOnOpenedEvent();
|
|
332
|
+
}
|
|
333
|
+
/** @ignore */
|
|
334
|
+
addKeyDownListener() {
|
|
359
335
|
if (isPlatformBrowser(this.platformID)) {
|
|
360
|
-
this.
|
|
361
|
-
if (e.key
|
|
336
|
+
this.onKeyDownHandler = (e) => {
|
|
337
|
+
if (e.key === 'Escape') {
|
|
362
338
|
this.close();
|
|
363
339
|
}
|
|
364
|
-
}
|
|
340
|
+
};
|
|
341
|
+
this.document.addEventListener('keydown', this.onKeyDownHandler);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
/** @ignore */
|
|
345
|
+
removeKeyDownListener() {
|
|
346
|
+
if (this.onKeyDownHandler) {
|
|
347
|
+
this.document.removeEventListener('keydown', this.onKeyDownHandler);
|
|
348
|
+
this.onKeyDownHandler = null;
|
|
365
349
|
}
|
|
366
|
-
this.saveFocus();
|
|
367
|
-
this.openOverlayInternal();
|
|
368
|
-
this._emitOnOpenedEvent();
|
|
369
350
|
}
|
|
370
351
|
/** @ignore */
|
|
371
352
|
saveFocus() {
|
|
@@ -376,97 +357,72 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
376
357
|
/** @ignore */
|
|
377
358
|
restoreFocus() {
|
|
378
359
|
if (this._lastActiveElement instanceof HTMLElement) {
|
|
379
|
-
|
|
380
|
-
this._lastActiveElement.focus();
|
|
381
|
-
}
|
|
360
|
+
this._lastActiveElement?.focus?.();
|
|
382
361
|
}
|
|
383
362
|
}
|
|
384
363
|
/** @ignore */
|
|
385
|
-
openOverlayInternal() {
|
|
364
|
+
async openOverlayInternal() {
|
|
386
365
|
const targetRef = this._target;
|
|
387
366
|
if (!targetRef)
|
|
388
367
|
return;
|
|
389
|
-
//
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
disposeOnNavigation: true,
|
|
394
|
-
scrollStrategy: this._overlay.scrollStrategies.block(),
|
|
395
|
-
panelClass: [
|
|
396
|
-
'ax-actionsheet-base',
|
|
397
|
-
'ax-animate-slideInUp',
|
|
398
|
-
'ax-animate-faster',
|
|
399
|
-
this.panelClass ? this.panelClass : this.#platform.isDark() ? 'ax-dark' : '',
|
|
400
|
-
],
|
|
401
|
-
hasBackdrop: true,
|
|
402
|
-
width: '100%',
|
|
403
|
-
});
|
|
368
|
+
// Build panel classes
|
|
369
|
+
const panelClasses = ['ax-overlay-pane', 'ax-animate-fadeIn', 'ax-animate-faster'];
|
|
370
|
+
if (this.platform.isDark()) {
|
|
371
|
+
panelClasses.push('ax-dark');
|
|
404
372
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
positionStrategy: this._overlay.position().flexibleConnectedTo(targetRef).withPositions(this._placements),
|
|
408
|
-
scrollStrategy: this._overlay.scrollStrategies.noop(),
|
|
409
|
-
disposeOnNavigation: true,
|
|
410
|
-
panelClass: ['ax-animate-fadeIn', 'ax-animate-faster', this.#platform.isDark() ? 'ax-dark' : ''],
|
|
411
|
-
maxHeight: 'unset',
|
|
412
|
-
hasBackdrop: this.hasBackdrop,
|
|
413
|
-
backdropClass: [this.backdropClass || 'cdk-overlay-transparent-backdrop'],
|
|
414
|
-
direction: AXHtmlUtil.isRtl(this.getHostElement()) ? 'rtl' : 'ltr',
|
|
415
|
-
width: this.width(),
|
|
416
|
-
});
|
|
417
|
-
// this._overlayRef.setDirection()
|
|
373
|
+
if (this.panelClass) {
|
|
374
|
+
panelClasses.push(this.panelClass);
|
|
418
375
|
}
|
|
419
|
-
//
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
//
|
|
376
|
+
// Determine content to display
|
|
377
|
+
let contentToRender;
|
|
378
|
+
let inputs;
|
|
423
379
|
if (this.content instanceof TemplateRef) {
|
|
424
|
-
|
|
425
|
-
$implicit: this.context,
|
|
426
|
-
ref: this,
|
|
427
|
-
});
|
|
428
|
-
this._overlayRef?.attach(this._portal);
|
|
380
|
+
contentToRender = this.content;
|
|
429
381
|
}
|
|
430
382
|
else if (typeof this.content === 'function') {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
Object.assign(this._componentRef.instance, this.context);
|
|
383
|
+
contentToRender = this.content;
|
|
384
|
+
inputs = this.context;
|
|
434
385
|
}
|
|
435
386
|
else {
|
|
436
|
-
|
|
437
|
-
$implicit: this.context,
|
|
438
|
-
ref: this,
|
|
439
|
-
});
|
|
440
|
-
this._overlayRef?.attach(this._portal);
|
|
387
|
+
contentToRender = this._baseTemplate;
|
|
441
388
|
}
|
|
389
|
+
// Create the overlay
|
|
390
|
+
this._overlayRef = await this.overlayService.create(contentToRender, {
|
|
391
|
+
inputs,
|
|
392
|
+
anchorOptions: {
|
|
393
|
+
anchor: targetRef,
|
|
394
|
+
placement: this._placement,
|
|
395
|
+
offsetX: this.offsetX,
|
|
396
|
+
offsetY: this.offsetY,
|
|
397
|
+
autoFlip: true,
|
|
398
|
+
},
|
|
399
|
+
panelClass: panelClasses,
|
|
400
|
+
width: this.width(),
|
|
401
|
+
onDispose: () => this.handleOverlayDisposed(),
|
|
402
|
+
});
|
|
403
|
+
// Store component ref if it's a component
|
|
404
|
+
if (this._overlayRef.instance && 'instance' in this._overlayRef.instance) {
|
|
405
|
+
this._componentRef = this._overlayRef.instance;
|
|
406
|
+
if (this.context && this._componentRef.instance) {
|
|
407
|
+
Object.assign(this._componentRef.instance, this.context);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
// Bind overlay events
|
|
411
|
+
this.bindOverlayEvents();
|
|
442
412
|
}
|
|
443
413
|
/**
|
|
444
414
|
* Checks if the overlay is currently open.
|
|
445
415
|
* @returns {boolean}
|
|
446
416
|
*/
|
|
447
417
|
get isOpen() {
|
|
448
|
-
return this._overlayRef
|
|
418
|
+
return this._overlayRef !== null;
|
|
449
419
|
}
|
|
450
420
|
/**
|
|
451
421
|
* Determines if the actionsheet style should be applied.
|
|
452
422
|
* @returns {boolean}
|
|
453
423
|
*/
|
|
454
424
|
get isActionsheetStyle() {
|
|
455
|
-
return this.
|
|
456
|
-
}
|
|
457
|
-
/** @ignore */
|
|
458
|
-
updatePositionStrategy() {
|
|
459
|
-
const targetRef = this._target;
|
|
460
|
-
if (!targetRef)
|
|
461
|
-
return;
|
|
462
|
-
let strategy;
|
|
463
|
-
if (this.isActionsheetStyle) {
|
|
464
|
-
strategy = this._overlay.position().global().bottom().centerHorizontally();
|
|
465
|
-
}
|
|
466
|
-
else {
|
|
467
|
-
strategy = this._overlay.position().flexibleConnectedTo(targetRef).withPositions(this._placements);
|
|
468
|
-
}
|
|
469
|
-
this._overlayRef?.updatePositionStrategy(strategy);
|
|
425
|
+
return this.platform.is('SM') && this.adaptivityEnabled;
|
|
470
426
|
}
|
|
471
427
|
/** @ignore */
|
|
472
428
|
updateOffset() {
|
|
@@ -488,7 +444,13 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
488
444
|
* Focuses the overlay element.
|
|
489
445
|
*/
|
|
490
446
|
focus() {
|
|
491
|
-
//
|
|
447
|
+
// Optional focus behavior
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Brings this popover to the front of all other overlays.
|
|
451
|
+
*/
|
|
452
|
+
bringToFront() {
|
|
453
|
+
this._overlayRef?.bringToFront();
|
|
492
454
|
}
|
|
493
455
|
/** @ignore */
|
|
494
456
|
initializeResizeObserver() {
|
|
@@ -499,7 +461,7 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
499
461
|
this.resizeObserver = new ResizeObserver(() => {
|
|
500
462
|
this.resize$.next();
|
|
501
463
|
});
|
|
502
|
-
this.resizeObserver.observe(this._overlayRef
|
|
464
|
+
this.resizeObserver.observe(this._overlayRef.overlayElement);
|
|
503
465
|
}
|
|
504
466
|
/** @ignore */
|
|
505
467
|
disconnectResizeObserver() {
|
|
@@ -508,12 +470,8 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
508
470
|
this.resizeObserver = null;
|
|
509
471
|
}
|
|
510
472
|
}
|
|
511
|
-
//
|
|
512
473
|
ngOnInit() {
|
|
513
474
|
super.ngOnInit();
|
|
514
|
-
// this.platformService.directionChange.subscribe((c) => {
|
|
515
|
-
// this.isRtl = c.data == 'rtl';
|
|
516
|
-
// });
|
|
517
475
|
this.resize$.pipe(debounceTime(50)).subscribe(() => {
|
|
518
476
|
if (this.isOpen) {
|
|
519
477
|
this.updatePosition();
|
|
@@ -526,8 +484,11 @@ class AXPopoverComponent extends MXBaseComponent {
|
|
|
526
484
|
this.resize$.complete();
|
|
527
485
|
this.removeTargetEvents();
|
|
528
486
|
this.removeOverlayEvents();
|
|
529
|
-
this.
|
|
530
|
-
this._overlayRef
|
|
487
|
+
this.removeKeyDownListener();
|
|
488
|
+
if (this._overlayRef) {
|
|
489
|
+
this._overlayRef.dispose();
|
|
490
|
+
this._overlayRef = null;
|
|
491
|
+
}
|
|
531
492
|
}
|
|
532
493
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXPopoverComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
533
494
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.9", type: AXPopoverComponent, isStandalone: true, selector: "ax-popover", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, offsetX: { classPropertyName: "offsetX", publicName: "offsetX", isSignal: false, isRequired: false, transformFunction: null }, offsetY: { classPropertyName: "offsetY", publicName: "offsetY", isSignal: false, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: false, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: false, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: false, isRequired: false, transformFunction: null }, openOn: { classPropertyName: "openOn", publicName: "openOn", isSignal: false, isRequired: false, transformFunction: null }, closeOn: { classPropertyName: "closeOn", publicName: "closeOn", isSignal: false, isRequired: false, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: false, isRequired: false, transformFunction: null }, openAfter: { classPropertyName: "openAfter", publicName: "openAfter", isSignal: false, isRequired: false, transformFunction: null }, closeAfter: { classPropertyName: "closeAfter", publicName: "closeAfter", isSignal: false, isRequired: false, transformFunction: null }, backdropClass: { classPropertyName: "backdropClass", publicName: "backdropClass", isSignal: false, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: false, isRequired: false, transformFunction: null }, adaptivityEnabled: { classPropertyName: "adaptivityEnabled", publicName: "adaptivityEnabled", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onOpened: "onOpened", onClosed: "onClosed" }, providers: [
|