@ibragim-dev-org/ui-forge-library 1.4.70 → 1.4.72
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i2 from '@angular/router';
|
|
2
2
|
import { NavigationEnd, NavigationStart, ActivationEnd } from '@angular/router';
|
|
3
|
-
import { BehaviorSubject, filter, take, scheduled, fromEvent, asyncScheduler, mergeAll, tap, debounceTime, Subject, Subscription, timer, switchMap, interval, takeWhile, finalize, takeUntil as takeUntil$1 } from 'rxjs';
|
|
3
|
+
import { BehaviorSubject, filter, take, scheduled, fromEvent, asyncScheduler, mergeAll, tap, debounceTime, Subject, Subscription, timer, switchMap, interval, takeWhile, finalize, ReplaySubject, takeUntil as takeUntil$1 } from 'rxjs';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
import { model, effect, Directive, Injectable, output, Input, input, PLATFORM_ID, Inject, EventEmitter, Output, signal, inject, Pipe, Attribute, ChangeDetectionStrategy, Component, computed, viewChild, untracked, Injector, afterRenderEffect, contentChildren, contentChild, ViewChildren } from '@angular/core';
|
|
6
6
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -1568,6 +1568,7 @@ class Alert {
|
|
|
1568
1568
|
title = '';
|
|
1569
1569
|
message = '';
|
|
1570
1570
|
icon = '';
|
|
1571
|
+
position = 'bottom';
|
|
1571
1572
|
component;
|
|
1572
1573
|
componentInputs;
|
|
1573
1574
|
constructor(init) {
|
|
@@ -1617,7 +1618,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
1617
1618
|
class UiAlertMessagesService {
|
|
1618
1619
|
uiAlertMessagesOverlayService;
|
|
1619
1620
|
router;
|
|
1620
|
-
$
|
|
1621
|
+
$topAlerts = signal([], ...(ngDevMode ? [{ debugName: "$topAlerts" }] : []));
|
|
1622
|
+
$bottomAlerts = signal([], ...(ngDevMode ? [{ debugName: "$bottomAlerts" }] : []));
|
|
1623
|
+
$alerts = computed(() => [...this.$topAlerts(), ...this.$bottomAlerts()], ...(ngDevMode ? [{ debugName: "$alerts" }] : []));
|
|
1621
1624
|
overlayRef;
|
|
1622
1625
|
timerSubscriptions = new Map();
|
|
1623
1626
|
timerState = new Map();
|
|
@@ -1631,6 +1634,7 @@ class UiAlertMessagesService {
|
|
|
1631
1634
|
type: AlertType.SUCCESS,
|
|
1632
1635
|
message: params.message,
|
|
1633
1636
|
icon: 'success.svg',
|
|
1637
|
+
position: params.position ?? 'bottom',
|
|
1634
1638
|
}));
|
|
1635
1639
|
}
|
|
1636
1640
|
error(params) {
|
|
@@ -1639,6 +1643,7 @@ class UiAlertMessagesService {
|
|
|
1639
1643
|
type: AlertType.ERROR,
|
|
1640
1644
|
message: params.message,
|
|
1641
1645
|
icon: 'error.svg',
|
|
1646
|
+
position: params.position ?? 'bottom',
|
|
1642
1647
|
}));
|
|
1643
1648
|
}
|
|
1644
1649
|
information(params) {
|
|
@@ -1647,6 +1652,7 @@ class UiAlertMessagesService {
|
|
|
1647
1652
|
type: AlertType.INFO,
|
|
1648
1653
|
message: params.message,
|
|
1649
1654
|
icon: 'info.svg',
|
|
1655
|
+
position: params.position ?? 'bottom',
|
|
1650
1656
|
}));
|
|
1651
1657
|
}
|
|
1652
1658
|
warning(params) {
|
|
@@ -1655,6 +1661,7 @@ class UiAlertMessagesService {
|
|
|
1655
1661
|
type: AlertType.WARNING,
|
|
1656
1662
|
message: params.message,
|
|
1657
1663
|
icon: 'warning.svg',
|
|
1664
|
+
position: params.position ?? 'bottom',
|
|
1658
1665
|
}));
|
|
1659
1666
|
}
|
|
1660
1667
|
pauseTimer(alert) {
|
|
@@ -1678,7 +1685,7 @@ class UiAlertMessagesService {
|
|
|
1678
1685
|
this.timerState.delete(alert.id);
|
|
1679
1686
|
timer(250)
|
|
1680
1687
|
.pipe(tap(() => {
|
|
1681
|
-
this
|
|
1688
|
+
this.getAlertsList(alert.position).update((alerts) => alerts.filter((x) => x !== alert));
|
|
1682
1689
|
}), switchMap(() => {
|
|
1683
1690
|
if (!this.$alerts().length) {
|
|
1684
1691
|
return timer(250).pipe(tap(() => {
|
|
@@ -1696,14 +1703,15 @@ class UiAlertMessagesService {
|
|
|
1696
1703
|
}
|
|
1697
1704
|
}
|
|
1698
1705
|
removeAll() {
|
|
1699
|
-
this.$
|
|
1706
|
+
this.$topAlerts.set([]);
|
|
1707
|
+
this.$bottomAlerts.set([]);
|
|
1700
1708
|
timer(250)
|
|
1701
1709
|
.pipe(tap(() => {
|
|
1702
1710
|
this.overlayRef?.detach();
|
|
1703
1711
|
}))
|
|
1704
1712
|
.subscribe();
|
|
1705
1713
|
}
|
|
1706
|
-
open(alert) {
|
|
1714
|
+
open(alert, closeIntervalParams = { useTimer: true, duration: 10000 }) {
|
|
1707
1715
|
if (!this.uiAlertMessagesOverlayService.component) {
|
|
1708
1716
|
this.uiAlertMessagesOverlayService.throwIfNotInitialized();
|
|
1709
1717
|
return;
|
|
@@ -1716,9 +1724,13 @@ class UiAlertMessagesService {
|
|
|
1716
1724
|
this.removeAll();
|
|
1717
1725
|
}), take(1))
|
|
1718
1726
|
.subscribe();
|
|
1719
|
-
this
|
|
1727
|
+
this.getAlertsList(alert.position).update((alerts) => [...alerts, alert]);
|
|
1728
|
+
const { useTimer, duration } = closeIntervalParams;
|
|
1729
|
+
if (!useTimer) {
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1720
1732
|
this.timerState.set(alert.id, { paused: false, elapsed: 0 });
|
|
1721
|
-
const DURATION =
|
|
1733
|
+
const DURATION = duration;
|
|
1722
1734
|
const CHECK_INTERVAL = 100;
|
|
1723
1735
|
const subscription = interval(CHECK_INTERVAL)
|
|
1724
1736
|
.pipe(takeWhile(() => {
|
|
@@ -1735,6 +1747,9 @@ class UiAlertMessagesService {
|
|
|
1735
1747
|
.subscribe();
|
|
1736
1748
|
this.timerSubscriptions.set(alert.id, subscription);
|
|
1737
1749
|
}
|
|
1750
|
+
getAlertsList(position) {
|
|
1751
|
+
return position === 'top' ? this.$topAlerts : this.$bottomAlerts;
|
|
1752
|
+
}
|
|
1738
1753
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, deps: [{ token: UiAlertMessagesOverlayService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1739
1754
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, providedIn: 'root' });
|
|
1740
1755
|
}
|
|
@@ -2333,8 +2348,9 @@ class UiPopupInstance {
|
|
|
2333
2348
|
triggerPulse$ = new Subject();
|
|
2334
2349
|
isHide$ = new Subject();
|
|
2335
2350
|
closed = new Subject();
|
|
2336
|
-
|
|
2337
|
-
|
|
2351
|
+
// Replayed so a container that subscribes after close() (before its first change detection) still closes.
|
|
2352
|
+
shouldClose = new ReplaySubject(1);
|
|
2353
|
+
closing = false;
|
|
2338
2354
|
constructor(overlayRef, destroyRef, onClose = () => { }, options = {
|
|
2339
2355
|
startOrigin: 'center center',
|
|
2340
2356
|
endOrigin: 'center center',
|
|
@@ -2358,11 +2374,14 @@ class UiPopupInstance {
|
|
|
2358
2374
|
}), takeUntilDestroyed(this.destroyRef))
|
|
2359
2375
|
.subscribe();
|
|
2360
2376
|
}
|
|
2377
|
+
get isClosing() {
|
|
2378
|
+
return this.closing;
|
|
2379
|
+
}
|
|
2361
2380
|
close() {
|
|
2362
|
-
if (this.
|
|
2381
|
+
if (this.closing) {
|
|
2363
2382
|
return;
|
|
2364
2383
|
}
|
|
2365
|
-
this.
|
|
2384
|
+
this.closing = true;
|
|
2366
2385
|
this.onClose();
|
|
2367
2386
|
this.shouldClose.next();
|
|
2368
2387
|
this.shouldClose.complete();
|
|
@@ -2593,7 +2612,9 @@ class UiPopupContainerDirective {
|
|
|
2593
2612
|
topStart: animationParams.topStart,
|
|
2594
2613
|
topEnd: animationParams.topEnd,
|
|
2595
2614
|
});
|
|
2596
|
-
this
|
|
2615
|
+
if (!this.popupInstance.isClosing) {
|
|
2616
|
+
this.$isShow.set(true);
|
|
2617
|
+
}
|
|
2597
2618
|
}), takeUntil$1(this.destroyAnimationOrigin$), takeUntilDestroyed(this.destroyRef))
|
|
2598
2619
|
.subscribe();
|
|
2599
2620
|
if (isBrowser()) {
|
|
@@ -3536,7 +3557,10 @@ class HoverTipDirective {
|
|
|
3536
3557
|
$offsetX = input(0, { ...(ngDevMode ? { debugName: "$offsetX" } : {}), alias: 'appHoverTipOffsetX' });
|
|
3537
3558
|
$offsetY = input(0, { ...(ngDevMode ? { debugName: "$offsetY" } : {}), alias: 'appHoverTipOffsetY' });
|
|
3538
3559
|
tipId = `hover-tip-${HoverTipDirective.instanceCounter++}`;
|
|
3539
|
-
|
|
3560
|
+
// Derived from the service: the tip can also be closed externally (Escape, closeAll on scroll/navigation).
|
|
3561
|
+
get isOpen() {
|
|
3562
|
+
return this.uiDropdownService.instances.some((instance) => instance.id === this.tipId);
|
|
3563
|
+
}
|
|
3540
3564
|
constructor(hostRef, uiDropdownService, destroyRef) {
|
|
3541
3565
|
this.hostRef = hostRef;
|
|
3542
3566
|
this.uiDropdownService = uiDropdownService;
|
|
@@ -3572,14 +3596,12 @@ class HoverTipDirective {
|
|
|
3572
3596
|
return;
|
|
3573
3597
|
}
|
|
3574
3598
|
this.uiDropdownService.openTip(text, this.hostRef.nativeElement, this.tipId, this.$position(), this.$offsetY(), this.$offsetX());
|
|
3575
|
-
this.isOpen = true;
|
|
3576
3599
|
}
|
|
3577
3600
|
closeTip() {
|
|
3578
3601
|
if (!this.isOpen) {
|
|
3579
3602
|
return;
|
|
3580
3603
|
}
|
|
3581
3604
|
this.uiDropdownService.closeById(this.tipId);
|
|
3582
|
-
this.isOpen = false;
|
|
3583
3605
|
}
|
|
3584
3606
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: HoverTipDirective, deps: [{ token: i0.ElementRef }, { token: UiDropdownService }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3585
3607
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: HoverTipDirective, isStandalone: true, selector: "[appHoverTip]", inputs: { $text: { classPropertyName: "$text", publicName: "appHoverTip", isSignal: true, isRequired: true, transformFunction: null }, $debounceTime: { classPropertyName: "$debounceTime", publicName: "$debounceTime", isSignal: true, isRequired: false, transformFunction: null }, $position: { classPropertyName: "$position", publicName: "appHoverTipPosition", isSignal: true, isRequired: false, transformFunction: null }, $offsetX: { classPropertyName: "$offsetX", publicName: "appHoverTipOffsetX", isSignal: true, isRequired: false, transformFunction: null }, $offsetY: { classPropertyName: "$offsetY", publicName: "appHoverTipOffsetY", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|