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