@ibragim-dev-org/ui-forge-library 1.4.0 → 1.4.2
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,16 +1,16 @@
|
|
|
1
1
|
import * as i2$1 from '@angular/router';
|
|
2
2
|
import { NavigationEnd, NavigationStart, ActivationEnd } from '@angular/router';
|
|
3
|
-
import { BehaviorSubject, filter, take, fromEvent, tap, debounceTime,
|
|
3
|
+
import { BehaviorSubject, filter, take, scheduled, fromEvent, asyncScheduler, mergeAll, tap, debounceTime, Subscription, timer, switchMap, interval, takeWhile, finalize, Subject, takeUntil } from 'rxjs';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { model, effect, Directive, Injectable,
|
|
5
|
+
import { model, effect, Directive, Injectable, output, Input, input, PLATFORM_ID, Inject, EventEmitter, Output, Pipe, Attribute, ChangeDetectionStrategy, Component, signal, computed, viewChild, untracked, Injector, afterRenderEffect, contentChildren, contentChild, ViewChildren } from '@angular/core';
|
|
6
6
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
7
|
import { isPlatformBrowser, DOCUMENT, NgStyle } from '@angular/common';
|
|
8
8
|
import * as i2 from '@angular/platform-browser';
|
|
9
9
|
import { PhoneNumberUtil, AsYouTypeFormatter } from 'google-libphonenumber';
|
|
10
|
+
import { ulid } from 'ulid';
|
|
10
11
|
import * as i1 from '@angular/cdk/overlay';
|
|
11
12
|
import { OverlayConfig, FlexibleConnectedPositionStrategy } from '@angular/cdk/overlay';
|
|
12
13
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
13
|
-
import { ulid } from 'ulid';
|
|
14
14
|
import { form } from '@angular/forms/signals';
|
|
15
15
|
|
|
16
16
|
class DateUtils {
|
|
@@ -367,12 +367,23 @@ class FocusDirective {
|
|
|
367
367
|
if (this.$focus()) {
|
|
368
368
|
this.el.nativeElement.focus();
|
|
369
369
|
}
|
|
370
|
+
else {
|
|
371
|
+
this.el.nativeElement.blur();
|
|
372
|
+
}
|
|
370
373
|
});
|
|
371
374
|
}
|
|
372
375
|
ngAfterViewInit() {
|
|
373
|
-
|
|
374
|
-
.
|
|
375
|
-
this
|
|
376
|
+
scheduled([
|
|
377
|
+
fromEvent(this.el.nativeElement, 'blur'),
|
|
378
|
+
fromEvent(this.el.nativeElement, 'keydown'),
|
|
379
|
+
], asyncScheduler)
|
|
380
|
+
.pipe(mergeAll(), tap((event) => {
|
|
381
|
+
if (event.type === 'blur') {
|
|
382
|
+
this.$focus.set(false);
|
|
383
|
+
}
|
|
384
|
+
if (event instanceof KeyboardEvent && event.key === 'Escape') {
|
|
385
|
+
this.$focus.set(false);
|
|
386
|
+
}
|
|
376
387
|
}), takeUntilDestroyed(this.destroyRef))
|
|
377
388
|
.subscribe();
|
|
378
389
|
}
|
|
@@ -416,11 +427,15 @@ class LazyImgDirective {
|
|
|
416
427
|
el;
|
|
417
428
|
lazyService;
|
|
418
429
|
lazySrc;
|
|
419
|
-
loadError =
|
|
430
|
+
loadError = output();
|
|
431
|
+
loaded = output();
|
|
420
432
|
observer;
|
|
421
433
|
onError = () => {
|
|
422
434
|
this.loadError.emit();
|
|
423
435
|
};
|
|
436
|
+
onLoad = () => {
|
|
437
|
+
this.loaded.emit();
|
|
438
|
+
};
|
|
424
439
|
constructor(el, lazyService) {
|
|
425
440
|
this.el = el;
|
|
426
441
|
this.lazyService = lazyService;
|
|
@@ -433,6 +448,7 @@ class LazyImgDirective {
|
|
|
433
448
|
return;
|
|
434
449
|
}
|
|
435
450
|
img.addEventListener('error', this.onError);
|
|
451
|
+
img.addEventListener('load', this.onLoad);
|
|
436
452
|
img.setAttribute('data-src', lazySrc);
|
|
437
453
|
this.observer = this.lazyService.getObserver();
|
|
438
454
|
this.observer.observe(img);
|
|
@@ -443,9 +459,10 @@ class LazyImgDirective {
|
|
|
443
459
|
this.observer.unobserve(img);
|
|
444
460
|
}
|
|
445
461
|
img.removeEventListener('error', this.onError);
|
|
462
|
+
img.removeEventListener('load', this.onLoad);
|
|
446
463
|
}
|
|
447
464
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: LazyImgDirective, deps: [{ token: i0.ElementRef }, { token: LazyImageService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
448
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.1", type: LazyImgDirective, isStandalone: true, selector: "img[lazySrc]", inputs: { lazySrc: "lazySrc" }, outputs: { loadError: "loadError" }, ngImport: i0 });
|
|
465
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.1", type: LazyImgDirective, isStandalone: true, selector: "img[lazySrc]", inputs: { lazySrc: "lazySrc" }, outputs: { loadError: "loadError", loaded: "loaded" }, ngImport: i0 });
|
|
449
466
|
}
|
|
450
467
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: LazyImgDirective, decorators: [{
|
|
451
468
|
type: Directive,
|
|
@@ -454,9 +471,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
454
471
|
}]
|
|
455
472
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: LazyImageService }], propDecorators: { lazySrc: [{
|
|
456
473
|
type: Input
|
|
457
|
-
}], loadError: [{
|
|
458
|
-
type: Output
|
|
459
|
-
}] } });
|
|
474
|
+
}], loadError: [{ type: i0.Output, args: ["loadError"] }], loaded: [{ type: i0.Output, args: ["loaded"] }] } });
|
|
460
475
|
|
|
461
476
|
class MaskGradientDirective {
|
|
462
477
|
elementRef;
|
|
@@ -642,6 +657,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
642
657
|
}]
|
|
643
658
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }] });
|
|
644
659
|
|
|
660
|
+
const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
661
|
+
|
|
645
662
|
class SkeletonDirective {
|
|
646
663
|
el;
|
|
647
664
|
renderer;
|
|
@@ -674,6 +691,8 @@ class SkeletonDirective {
|
|
|
674
691
|
this.renderer.removeStyle(this.el.nativeElement, 'overflow');
|
|
675
692
|
}
|
|
676
693
|
injectKeyframes() {
|
|
694
|
+
if (!isBrowser())
|
|
695
|
+
return;
|
|
677
696
|
const styleSheet = document.styleSheets[0];
|
|
678
697
|
if (!styleSheet)
|
|
679
698
|
return;
|
|
@@ -795,7 +814,7 @@ function getAspectRatioFit(maxWidth, maxHeight, srcWidth, srcHeight) {
|
|
|
795
814
|
return { width: maxWidth, height: maxHeight };
|
|
796
815
|
}
|
|
797
816
|
|
|
798
|
-
const
|
|
817
|
+
const COLORS = [
|
|
799
818
|
// Reds
|
|
800
819
|
{ solid: '#FF7A7A', gradientStart: '#FF7A7A', gradientEnd: '#D74A59' },
|
|
801
820
|
{ solid: '#FF6C6C', gradientStart: '#FF6C6C', gradientEnd: '#D64545' },
|
|
@@ -841,6 +860,23 @@ const COLOR_FAMILIES = [
|
|
|
841
860
|
// Magenta
|
|
842
861
|
{ solid: '#FF7BD9', gradientStart: '#FF7BD9', gradientEnd: '#E054B9' },
|
|
843
862
|
];
|
|
863
|
+
function seededRandom(seed) {
|
|
864
|
+
return () => {
|
|
865
|
+
seed = (seed * 9301 + 49297) % 233280;
|
|
866
|
+
return seed / 233280;
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
function seededShuffle(arr, seed = 1337) {
|
|
870
|
+
const random = seededRandom(seed);
|
|
871
|
+
const copy = [...arr];
|
|
872
|
+
for (let i = copy.length - 1; i > 0; i--) {
|
|
873
|
+
const j = Math.floor(random() * (i + 1));
|
|
874
|
+
[copy[i], copy[j]] = [copy[j], copy[i]];
|
|
875
|
+
}
|
|
876
|
+
return copy;
|
|
877
|
+
}
|
|
878
|
+
// Shuffled palette for this session
|
|
879
|
+
const SHUFFLED_COLORS = seededShuffle(COLORS, 20240612);
|
|
844
880
|
const hashValue = (value) => {
|
|
845
881
|
if (!value || typeof value !== 'string') {
|
|
846
882
|
return 0;
|
|
@@ -854,7 +890,7 @@ const hashValue = (value) => {
|
|
|
854
890
|
};
|
|
855
891
|
const pickColorFamily = (value) => {
|
|
856
892
|
const absHash = hashValue(value);
|
|
857
|
-
return
|
|
893
|
+
return SHUFFLED_COLORS[absHash % SHUFFLED_COLORS.length];
|
|
858
894
|
};
|
|
859
895
|
const hexToRgb = (hex) => {
|
|
860
896
|
const value = hex.replace('#', '');
|
|
@@ -1224,16 +1260,54 @@ class Alert {
|
|
|
1224
1260
|
}
|
|
1225
1261
|
}
|
|
1226
1262
|
|
|
1227
|
-
class
|
|
1263
|
+
class UiAlertMessagesOverlayService {
|
|
1228
1264
|
overlay;
|
|
1265
|
+
component = null;
|
|
1266
|
+
overlayRef;
|
|
1267
|
+
constructor(component, overlay) {
|
|
1268
|
+
this.overlay = overlay;
|
|
1269
|
+
this.init(component);
|
|
1270
|
+
}
|
|
1271
|
+
attachComponent() {
|
|
1272
|
+
if (!this.component) {
|
|
1273
|
+
this.throwIfNotInitialized();
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
const strategy = this.overlay.position().global();
|
|
1277
|
+
const config = new OverlayConfig({
|
|
1278
|
+
positionStrategy: strategy,
|
|
1279
|
+
});
|
|
1280
|
+
this.overlayRef = this.overlay.create(config);
|
|
1281
|
+
this.overlayRef.attach(new ComponentPortal(this.component));
|
|
1282
|
+
}
|
|
1283
|
+
init(component) {
|
|
1284
|
+
this.component = component;
|
|
1285
|
+
}
|
|
1286
|
+
throwIfNotInitialized() {
|
|
1287
|
+
if (!this.component) {
|
|
1288
|
+
throw new Error('[UiAlertMessagesOverlayService] AlertMessagesComponent has not been initialized. ' +
|
|
1289
|
+
'Call `init(AlertMessagesComponent)` during application startup (e.g. in `app.config.ts`) to enable alert rendering.');
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesOverlayService, deps: [{ token: i0.Type }, { token: i1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1293
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesOverlayService, providedIn: 'root' });
|
|
1294
|
+
}
|
|
1295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesOverlayService, decorators: [{
|
|
1296
|
+
type: Injectable,
|
|
1297
|
+
args: [{
|
|
1298
|
+
providedIn: 'root',
|
|
1299
|
+
}]
|
|
1300
|
+
}], ctorParameters: () => [{ type: i0.Type }, { type: i1.Overlay }] });
|
|
1301
|
+
|
|
1302
|
+
class UiAlertMessagesService {
|
|
1303
|
+
uiAlertMessagesOverlayService;
|
|
1229
1304
|
router;
|
|
1230
1305
|
$alerts = signal([], ...(ngDevMode ? [{ debugName: "$alerts" }] : []));
|
|
1231
1306
|
overlayRef;
|
|
1232
|
-
component = null;
|
|
1233
1307
|
timerSubscriptions = new Map();
|
|
1234
1308
|
timerState = new Map();
|
|
1235
|
-
constructor(
|
|
1236
|
-
this.
|
|
1309
|
+
constructor(uiAlertMessagesOverlayService, router) {
|
|
1310
|
+
this.uiAlertMessagesOverlayService = uiAlertMessagesOverlayService;
|
|
1237
1311
|
this.router = router;
|
|
1238
1312
|
}
|
|
1239
1313
|
success(params) {
|
|
@@ -1314,22 +1388,13 @@ class UiAlertMessagesService {
|
|
|
1314
1388
|
}))
|
|
1315
1389
|
.subscribe();
|
|
1316
1390
|
}
|
|
1317
|
-
init(component) {
|
|
1318
|
-
this.component = component;
|
|
1319
|
-
const strategy = this.overlay.position().global();
|
|
1320
|
-
const config = new OverlayConfig({
|
|
1321
|
-
positionStrategy: strategy,
|
|
1322
|
-
});
|
|
1323
|
-
this.overlayRef = this.overlay.create(config);
|
|
1324
|
-
this.overlayRef.attach(new ComponentPortal(this.component));
|
|
1325
|
-
}
|
|
1326
1391
|
open(alert) {
|
|
1327
|
-
if (!this.component) {
|
|
1328
|
-
|
|
1329
|
-
|
|
1392
|
+
if (!this.uiAlertMessagesOverlayService.component) {
|
|
1393
|
+
this.uiAlertMessagesOverlayService.throwIfNotInitialized();
|
|
1394
|
+
return;
|
|
1330
1395
|
}
|
|
1331
1396
|
if (!this.$alerts().length) {
|
|
1332
|
-
this.
|
|
1397
|
+
this.uiAlertMessagesOverlayService.attachComponent();
|
|
1333
1398
|
}
|
|
1334
1399
|
this.router.events
|
|
1335
1400
|
.pipe(filter((v) => v instanceof NavigationEnd), tap(() => {
|
|
@@ -1355,7 +1420,7 @@ class UiAlertMessagesService {
|
|
|
1355
1420
|
.subscribe();
|
|
1356
1421
|
this.timerSubscriptions.set(alert.id, subscription);
|
|
1357
1422
|
}
|
|
1358
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, deps: [{ token:
|
|
1423
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, deps: [{ token: UiAlertMessagesOverlayService }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1359
1424
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, providedIn: 'root' });
|
|
1360
1425
|
}
|
|
1361
1426
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, decorators: [{
|
|
@@ -1363,7 +1428,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
1363
1428
|
args: [{
|
|
1364
1429
|
providedIn: 'root',
|
|
1365
1430
|
}]
|
|
1366
|
-
}], ctorParameters: () => [{ type:
|
|
1431
|
+
}], ctorParameters: () => [{ type: UiAlertMessagesOverlayService }, { type: i2$1.Router }] });
|
|
1367
1432
|
|
|
1368
1433
|
const avatarSizes = ['small', 'medium', 'large'];
|
|
1369
1434
|
class UiAvatarDirective {
|
|
@@ -1374,7 +1439,7 @@ class UiAvatarDirective {
|
|
|
1374
1439
|
$src = input.required(...(ngDevMode ? [{ debugName: "$src" }] : []));
|
|
1375
1440
|
$acronym = input.required(...(ngDevMode ? [{ debugName: "$acronym" }] : []));
|
|
1376
1441
|
$text = signal('', ...(ngDevMode ? [{ debugName: "$text" }] : []));
|
|
1377
|
-
$canShowAvatar = signal(
|
|
1442
|
+
$canShowAvatar = signal(false, ...(ngDevMode ? [{ debugName: "$canShowAvatar" }] : []));
|
|
1378
1443
|
constructor(elementRef, renderer) {
|
|
1379
1444
|
this.elementRef = elementRef;
|
|
1380
1445
|
this.renderer = renderer;
|
|
@@ -1385,7 +1450,7 @@ class UiAvatarDirective {
|
|
|
1385
1450
|
.slice(0, 2)
|
|
1386
1451
|
.map((word) => word[0]?.toUpperCase() || '')
|
|
1387
1452
|
.join('');
|
|
1388
|
-
const colorValue = acronym
|
|
1453
|
+
const colorValue = this.$acronym();
|
|
1389
1454
|
this.renderer.setStyle(this.elementRef.nativeElement, 'background', stringToColorGradient(colorValue));
|
|
1390
1455
|
this.$text.set(acronym);
|
|
1391
1456
|
});
|
|
@@ -1973,25 +2038,42 @@ class UiPopupInstance {
|
|
|
1973
2038
|
}
|
|
1974
2039
|
}
|
|
1975
2040
|
|
|
2041
|
+
class UiPopupBackdropService {
|
|
2042
|
+
tipContainerPortal;
|
|
2043
|
+
backdropPortal;
|
|
2044
|
+
constructor(component, tipComponent) {
|
|
2045
|
+
this.backdropPortal = new ComponentPortal(component);
|
|
2046
|
+
if (tipComponent) {
|
|
2047
|
+
this.tipContainerPortal = new ComponentPortal(tipComponent);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, deps: [{ token: i0.Type }, { token: i0.Type }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2051
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, providedIn: 'root' });
|
|
2052
|
+
}
|
|
2053
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, decorators: [{
|
|
2054
|
+
type: Injectable,
|
|
2055
|
+
args: [{
|
|
2056
|
+
providedIn: 'root',
|
|
2057
|
+
}]
|
|
2058
|
+
}], ctorParameters: () => [{ type: i0.Type }, { type: i0.Type }] });
|
|
2059
|
+
|
|
1976
2060
|
class UiPopupService {
|
|
1977
2061
|
overlay;
|
|
1978
2062
|
injector;
|
|
1979
2063
|
destroyRef;
|
|
1980
2064
|
router;
|
|
2065
|
+
backdropService;
|
|
1981
2066
|
popupInstances = [];
|
|
1982
2067
|
backdropRef;
|
|
1983
|
-
backdropPortal;
|
|
1984
2068
|
backdropPortalRef;
|
|
1985
2069
|
destroyDownloading$ = new Subject();
|
|
1986
2070
|
destroyOutsideClickSubscription$ = new Subject();
|
|
1987
|
-
constructor(overlay, injector, destroyRef, router) {
|
|
2071
|
+
constructor(overlay, injector, destroyRef, router, backdropService) {
|
|
1988
2072
|
this.overlay = overlay;
|
|
1989
2073
|
this.injector = injector;
|
|
1990
2074
|
this.destroyRef = destroyRef;
|
|
1991
2075
|
this.router = router;
|
|
1992
|
-
|
|
1993
|
-
init(component) {
|
|
1994
|
-
this.backdropPortal = new ComponentPortal(component);
|
|
2076
|
+
this.backdropService = backdropService;
|
|
1995
2077
|
}
|
|
1996
2078
|
/**
|
|
1997
2079
|
* Opens a popup with the specified component and options.
|
|
@@ -2115,11 +2197,13 @@ class UiPopupService {
|
|
|
2115
2197
|
*/
|
|
2116
2198
|
subscribeToOutsideEvents() {
|
|
2117
2199
|
this.destroyOutsideClickSubscription$.next();
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
.
|
|
2200
|
+
if (isBrowser()) {
|
|
2201
|
+
fromEvent(window, 'scroll')
|
|
2202
|
+
.pipe(tap(() => {
|
|
2203
|
+
this.closeAll();
|
|
2204
|
+
}), takeUntil(this.destroyOutsideClickSubscription$))
|
|
2205
|
+
.subscribe();
|
|
2206
|
+
}
|
|
2123
2207
|
this.router.events
|
|
2124
2208
|
.pipe(debounceTime(100), tap(() => {
|
|
2125
2209
|
this.closeAll();
|
|
@@ -2131,7 +2215,9 @@ class UiPopupService {
|
|
|
2131
2215
|
this.destroyOutsideClickSubscription$.next();
|
|
2132
2216
|
}
|
|
2133
2217
|
showBackdrop(isStaticBackdrop = false) {
|
|
2134
|
-
|
|
2218
|
+
if (isBrowser()) {
|
|
2219
|
+
document.body.style.setProperty('overflow-y', 'hidden');
|
|
2220
|
+
}
|
|
2135
2221
|
if (this.backdropRef) {
|
|
2136
2222
|
return;
|
|
2137
2223
|
}
|
|
@@ -2140,7 +2226,11 @@ class UiPopupService {
|
|
|
2140
2226
|
positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
|
|
2141
2227
|
scrollStrategy: this.overlay.scrollStrategies.noop(),
|
|
2142
2228
|
});
|
|
2143
|
-
|
|
2229
|
+
if (!this.backdropService.backdropPortal) {
|
|
2230
|
+
throw new Error('[UiPopupService] UiPopupBackdropService has not been initialized. ' +
|
|
2231
|
+
'inject(UiPopupBackdropService) during application startup (e.g. in `app.config.ts`) to enable popup rendering.');
|
|
2232
|
+
}
|
|
2233
|
+
this.backdropPortalRef = this.backdropRef.attach(this.backdropService.backdropPortal);
|
|
2144
2234
|
if (this.backdropPortalRef) {
|
|
2145
2235
|
this.backdropPortalRef.location.nativeElement.classList.add('animate-in');
|
|
2146
2236
|
this.backdropPortalRef.setInput('isStaticBackdrop', isStaticBackdrop);
|
|
@@ -2159,7 +2249,9 @@ class UiPopupService {
|
|
|
2159
2249
|
this.backdropRef?.detach();
|
|
2160
2250
|
this.backdropRef?.dispose();
|
|
2161
2251
|
this.backdropRef = undefined;
|
|
2162
|
-
|
|
2252
|
+
if (isBrowser()) {
|
|
2253
|
+
document.body.style.setProperty('overflow-y', 'auto');
|
|
2254
|
+
}
|
|
2163
2255
|
}))
|
|
2164
2256
|
.subscribe();
|
|
2165
2257
|
}
|
|
@@ -2186,13 +2278,15 @@ class UiPopupService {
|
|
|
2186
2278
|
}
|
|
2187
2279
|
createScaleAnimationOptionsFromElement(originElement, sourceWidth, sourceHeight) {
|
|
2188
2280
|
const rect = originElement.getBoundingClientRect();
|
|
2189
|
-
const
|
|
2190
|
-
const
|
|
2281
|
+
const viewportWidth = isBrowser() ? window.innerWidth : sourceWidth;
|
|
2282
|
+
const viewportHeight = isBrowser() ? window.innerHeight : sourceHeight;
|
|
2283
|
+
const centerX = viewportWidth / 2;
|
|
2284
|
+
const centerY = viewportHeight / 2;
|
|
2191
2285
|
const targetX = rect.left + rect.width / 2;
|
|
2192
2286
|
const targetY = rect.top + rect.height / 2;
|
|
2193
2287
|
const offsetX = targetX - centerX;
|
|
2194
2288
|
const offsetY = targetY - centerY;
|
|
2195
|
-
const fitted = getAspectRatioFit(
|
|
2289
|
+
const fitted = getAspectRatioFit(viewportWidth - viewportWidth / 8, viewportHeight - viewportHeight / 8, sourceWidth, sourceHeight);
|
|
2196
2290
|
const scaleY = Math.trunc((sourceHeight / fitted.height) * 100) / 100;
|
|
2197
2291
|
const scaleX = Math.trunc((sourceWidth / fitted.width) * 100) / 100;
|
|
2198
2292
|
return {
|
|
@@ -2202,7 +2296,7 @@ class UiPopupService {
|
|
|
2202
2296
|
endTransition: 'scale(1)',
|
|
2203
2297
|
};
|
|
2204
2298
|
}
|
|
2205
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, deps: [{ token: i1.Overlay }, { token: i0.Injector }, { token: i0.DestroyRef }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2299
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, deps: [{ token: i1.Overlay }, { token: i0.Injector }, { token: i0.DestroyRef }, { token: i2$1.Router }, { token: UiPopupBackdropService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2206
2300
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, providedIn: 'root' });
|
|
2207
2301
|
}
|
|
2208
2302
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, decorators: [{
|
|
@@ -2210,7 +2304,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
2210
2304
|
args: [{
|
|
2211
2305
|
providedIn: 'root',
|
|
2212
2306
|
}]
|
|
2213
|
-
}], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.Injector }, { type: i0.DestroyRef }, { type: i2$1.Router }] });
|
|
2307
|
+
}], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.Injector }, { type: i0.DestroyRef }, { type: i2$1.Router }, { type: UiPopupBackdropService }] });
|
|
2214
2308
|
|
|
2215
2309
|
class UiPopupContainerDirective {
|
|
2216
2310
|
popupInstance;
|
|
@@ -2281,13 +2375,15 @@ class UiPopupContainerDirective {
|
|
|
2281
2375
|
this.$isShow.set(true);
|
|
2282
2376
|
}), takeUntil(this.destroyAnimationOrigin$), takeUntilDestroyed(this.destroyRef))
|
|
2283
2377
|
.subscribe();
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
.
|
|
2378
|
+
if (isBrowser()) {
|
|
2379
|
+
fromEvent(window, 'keydown')
|
|
2380
|
+
.pipe(tap((e) => {
|
|
2381
|
+
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
2382
|
+
this.close();
|
|
2383
|
+
}
|
|
2384
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2385
|
+
.subscribe();
|
|
2386
|
+
}
|
|
2291
2387
|
}
|
|
2292
2388
|
close() {
|
|
2293
2389
|
if (this.popupInstance.id) {
|
|
@@ -2318,7 +2414,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
2318
2414
|
}] }, { type: i0.DestroyRef }, { type: UiPopupService }, { type: i0.ElementRef }], propDecorators: { $overflowHidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "$overflowHidden", required: false }] }], $shouldClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "$shouldClose", required: false }] }, { type: i0.Output, args: ["$shouldCloseChange"] }], $hasCloseButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "$hasCloseButton", required: false }] }], $isEnableFadeAnimation: [{ type: i0.Input, args: [{ isSignal: true, alias: "$isEnableFadeAnimation", required: false }] }], $iconClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "$iconClose", required: false }] }, { type: i0.Output, args: ["$iconCloseChange"] }] } });
|
|
2319
2415
|
|
|
2320
2416
|
class UiDropdownService extends UiPopupService {
|
|
2321
|
-
tipContainerPortal;
|
|
2322
2417
|
containerSize$ = new BehaviorSubject({
|
|
2323
2418
|
width: 0,
|
|
2324
2419
|
height: 0,
|
|
@@ -2424,12 +2519,6 @@ class UiDropdownService extends UiPopupService {
|
|
|
2424
2519
|
},
|
|
2425
2520
|
},
|
|
2426
2521
|
};
|
|
2427
|
-
init(component, tipComponent) {
|
|
2428
|
-
super.init(component);
|
|
2429
|
-
if (tipComponent) {
|
|
2430
|
-
this.tipContainerPortal = new ComponentPortal(tipComponent);
|
|
2431
|
-
}
|
|
2432
|
-
}
|
|
2433
2522
|
/**
|
|
2434
2523
|
* Opens a tooltip (tip) component attached to a specific HTML element.
|
|
2435
2524
|
* The tooltip displays text content with customizable position and offset.
|
|
@@ -2445,11 +2534,11 @@ class UiDropdownService extends UiPopupService {
|
|
|
2445
2534
|
*
|
|
2446
2535
|
*/
|
|
2447
2536
|
openTip(text, attachedRef, id, position = 'top', offsetY = 0, offsetX = 0) {
|
|
2448
|
-
if (!this.tipContainerPortal) {
|
|
2449
|
-
|
|
2450
|
-
|
|
2537
|
+
if (!this.backdropService.tipContainerPortal) {
|
|
2538
|
+
throw new Error('[UiDropdownService] Tip component is not defined. ' +
|
|
2539
|
+
'inject(UiPopupBackdropService) during application startup (e.g. in `app.config.ts`) to enable tip rendering.');
|
|
2451
2540
|
}
|
|
2452
|
-
const tipComponent = this.tipContainerPortal?.component;
|
|
2541
|
+
const tipComponent = this.backdropService.tipContainerPortal?.component;
|
|
2453
2542
|
if (tipComponent) {
|
|
2454
2543
|
this.openAttached(tipComponent, attachedRef, id, {
|
|
2455
2544
|
options: {
|
|
@@ -2486,7 +2575,7 @@ class UiDropdownService extends UiPopupService {
|
|
|
2486
2575
|
if (fetchedParameters.removePrevious && this.popupInstances.length) {
|
|
2487
2576
|
this.close();
|
|
2488
2577
|
}
|
|
2489
|
-
if (window.matchMedia('(max-width: 48rem)').matches) {
|
|
2578
|
+
if (isBrowser() && window.matchMedia('(max-width: 48rem)').matches) {
|
|
2490
2579
|
this.showBackdrop();
|
|
2491
2580
|
}
|
|
2492
2581
|
const overlayRef = this.overlay.create({
|
|
@@ -2518,7 +2607,7 @@ class UiDropdownService extends UiPopupService {
|
|
|
2518
2607
|
if (fetchedParameters.removePrevious && this.popupInstances.length) {
|
|
2519
2608
|
this.close();
|
|
2520
2609
|
}
|
|
2521
|
-
if (window.matchMedia('(max-width: 48rem)').matches) {
|
|
2610
|
+
if (isBrowser() && window.matchMedia('(max-width: 48rem)').matches) {
|
|
2522
2611
|
this.showBackdrop();
|
|
2523
2612
|
}
|
|
2524
2613
|
const overlayRef = this.overlay.create({
|
|
@@ -2562,8 +2651,10 @@ class UiDropdownService extends UiPopupService {
|
|
|
2562
2651
|
*/
|
|
2563
2652
|
calculateMousePositionAnimationOrigin(event, containerSize) {
|
|
2564
2653
|
const EDGE_MARGIN = 20;
|
|
2565
|
-
const
|
|
2566
|
-
const
|
|
2654
|
+
const viewportWidth = isBrowser() ? document.body.clientWidth : 0;
|
|
2655
|
+
const viewportHeight = isBrowser() ? document.body.clientHeight : 0;
|
|
2656
|
+
const rightSpace = viewportWidth - event.clientX;
|
|
2657
|
+
const bottomSpace = viewportHeight - event.clientY;
|
|
2567
2658
|
const hasRightSpace = rightSpace >= containerSize.width + EDGE_MARGIN;
|
|
2568
2659
|
const hasBottomSpace = bottomSpace >= containerSize.height + EDGE_MARGIN;
|
|
2569
2660
|
if (!hasRightSpace && !hasBottomSpace) {
|
|
@@ -2587,8 +2678,10 @@ class UiDropdownService extends UiPopupService {
|
|
|
2587
2678
|
*/
|
|
2588
2679
|
calculateMousePositionAdjustment(event, containerSize) {
|
|
2589
2680
|
const EDGE_MARGIN = 20;
|
|
2590
|
-
const
|
|
2591
|
-
const
|
|
2681
|
+
const viewportWidth = isBrowser() ? document.body.clientWidth : 0;
|
|
2682
|
+
const viewportHeight = isBrowser() ? document.body.clientHeight : 0;
|
|
2683
|
+
const rightSpace = viewportWidth - event.clientX;
|
|
2684
|
+
const bottomSpace = viewportHeight - event.clientY;
|
|
2592
2685
|
let left = event.clientX;
|
|
2593
2686
|
let top = event.clientY;
|
|
2594
2687
|
if (rightSpace < containerSize.width + EDGE_MARGIN && bottomSpace < containerSize.height + EDGE_MARGIN) {
|
|
@@ -2610,7 +2703,7 @@ class UiDropdownService extends UiPopupService {
|
|
|
2610
2703
|
* @returns The configured PositionStrategy for the overlay.
|
|
2611
2704
|
*/
|
|
2612
2705
|
createMousePositionStrategy(event) {
|
|
2613
|
-
if (window.innerWidth <= 768) {
|
|
2706
|
+
if (!isBrowser() || window.innerWidth <= 768) {
|
|
2614
2707
|
return this.overlay.position().global().bottom();
|
|
2615
2708
|
}
|
|
2616
2709
|
return this.overlay
|
|
@@ -2661,7 +2754,7 @@ class UiDropdownService extends UiPopupService {
|
|
|
2661
2754
|
* @returns The configured PositionStrategy for the overlay.
|
|
2662
2755
|
*/
|
|
2663
2756
|
createPositionStrategy(attachedRef, parameters, offsetX, offsetY) {
|
|
2664
|
-
if (window.innerWidth <= 768) {
|
|
2757
|
+
if (!isBrowser() || window.innerWidth <= 768) {
|
|
2665
2758
|
return this.overlay.position().global().bottom();
|
|
2666
2759
|
}
|
|
2667
2760
|
return this.overlay
|
|
@@ -2711,7 +2804,7 @@ class UiDropdownContainerDirective extends UiPopupContainerDirective {
|
|
|
2711
2804
|
}
|
|
2712
2805
|
ngOnInit() {
|
|
2713
2806
|
super.ngOnInit();
|
|
2714
|
-
if (window.innerWidth <= 768) {
|
|
2807
|
+
if (isBrowser() && window.innerWidth <= 768) {
|
|
2715
2808
|
this.destroyAnimationOrigin$.next();
|
|
2716
2809
|
this.$animationParams.set({
|
|
2717
2810
|
startOrigin: 'bottom center',
|
|
@@ -2828,11 +2921,13 @@ class HoverTipDirective {
|
|
|
2828
2921
|
this.closeTip();
|
|
2829
2922
|
}), takeUntilDestroyed(this.destroyRef))
|
|
2830
2923
|
.subscribe();
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
.
|
|
2924
|
+
if (isBrowser()) {
|
|
2925
|
+
fromEvent(window, 'blur')
|
|
2926
|
+
.pipe(tap(() => {
|
|
2927
|
+
this.closeTip();
|
|
2928
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2929
|
+
.subscribe();
|
|
2930
|
+
}
|
|
2836
2931
|
}
|
|
2837
2932
|
openTip() {
|
|
2838
2933
|
const text = this.$text().trim();
|
|
@@ -2937,6 +3032,11 @@ class UiPopupImageDirective {
|
|
|
2937
3032
|
this.destroyRef = destroyRef;
|
|
2938
3033
|
}
|
|
2939
3034
|
ngOnInit() {
|
|
3035
|
+
if (!isBrowser()) {
|
|
3036
|
+
this.$imageWidth.set(this.width);
|
|
3037
|
+
this.$imageHeight.set(this.height);
|
|
3038
|
+
return;
|
|
3039
|
+
}
|
|
2940
3040
|
const result = getAspectRatioFit(window.innerWidth - window.innerWidth / 8, window.innerHeight - window.innerHeight / 8, this.width, this.height);
|
|
2941
3041
|
this.$imageWidth.set(result.width);
|
|
2942
3042
|
this.$imageHeight.set(result.height);
|
|
@@ -2945,6 +3045,8 @@ class UiPopupImageDirective {
|
|
|
2945
3045
|
const container = this.$container()?.nativeElement;
|
|
2946
3046
|
if (!container)
|
|
2947
3047
|
return;
|
|
3048
|
+
if (!isBrowser())
|
|
3049
|
+
return;
|
|
2948
3050
|
this.size = {
|
|
2949
3051
|
w: container.offsetWidth,
|
|
2950
3052
|
h: container.offsetHeight,
|
|
@@ -3310,6 +3412,9 @@ class UiCopyButtonDirective {
|
|
|
3310
3412
|
this.destroyRef = destroyRef;
|
|
3311
3413
|
}
|
|
3312
3414
|
copy() {
|
|
3415
|
+
if (!isBrowser()) {
|
|
3416
|
+
return;
|
|
3417
|
+
}
|
|
3313
3418
|
this.destroyTimer$.next();
|
|
3314
3419
|
const text = this.$text();
|
|
3315
3420
|
if (window.navigator.clipboard && window.navigator.clipboard.writeText) {
|
|
@@ -4265,5 +4370,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
4265
4370
|
* Generated bundle index. Do not edit.
|
|
4266
4371
|
*/
|
|
4267
4372
|
|
|
4268
|
-
export { Alert, AlertType, AppIconsLibrary, CalendarUtils, CenterEllipsisPipe, ContainerSizeDirective, CountryService, DateUtils, EMAIL, FocusDirective, HAS_CAPITAL_CASE, HAS_NUMBER, HAS_SMALL_CASE, HAS_SPECIAL_CHARTERS, HoverTipDirective, IconComponent, LazyImgDirective, MIN_LENGTH, MaskGradientDirective, RouterBehavior, SkeletonDirective, StickyObserverDirective, ThemeService, TrackLifecycleDirective, UIInputDateDirective, UIPhoneNumberDirective, UiAccordionComponent, UiAlertMessagesService, UiAvatarDirective, UiButtonDirective, UiCalendarDropdownDirective, UiCodeDirective, UiCopyButtonDirective, UiDailyCalendarDirective, UiDropdownContainerDirective, UiDropdownService, UiFieldBaseDirective, UiImageDirective, UiInputCheckboxDirective, UiInputCountryDirective, UiInputDirective, UiInputSelectDirective, UiInputSequenceDirective, UiInputTimeDirective, UiMonthlyCalendarDirective, UiPaginationDirective, UiPopupBackdropDirective, UiPopupContainerDirective, UiPopupImageDirective, UiPopupInstance, UiPopupService, UiSelectButtonsDirective, UiTabsDirective, UiTimeDropdownDirective, UiValidationErrorsDirective, UiYearlyCalendarDirective, createNavigation, createUrl, createUrlTree, emptyCountry, extractParam, getAspectRatioFit, navigateByUrl, stringToColorGradient, stringToHslColor };
|
|
4373
|
+
export { Alert, AlertType, AppIconsLibrary, CalendarUtils, CenterEllipsisPipe, ContainerSizeDirective, CountryService, DateUtils, EMAIL, FocusDirective, HAS_CAPITAL_CASE, HAS_NUMBER, HAS_SMALL_CASE, HAS_SPECIAL_CHARTERS, HoverTipDirective, IconComponent, LazyImgDirective, MIN_LENGTH, MaskGradientDirective, RouterBehavior, SkeletonDirective, StickyObserverDirective, ThemeService, TrackLifecycleDirective, UIInputDateDirective, UIPhoneNumberDirective, UiAccordionComponent, UiAlertMessagesOverlayService, UiAlertMessagesService, UiAvatarDirective, UiButtonDirective, UiCalendarDropdownDirective, UiCodeDirective, UiCopyButtonDirective, UiDailyCalendarDirective, UiDropdownContainerDirective, UiDropdownService, UiFieldBaseDirective, UiImageDirective, UiInputCheckboxDirective, UiInputCountryDirective, UiInputDirective, UiInputSelectDirective, UiInputSequenceDirective, UiInputTimeDirective, UiMonthlyCalendarDirective, UiPaginationDirective, UiPopupBackdropDirective, UiPopupBackdropService, UiPopupContainerDirective, UiPopupImageDirective, UiPopupInstance, UiPopupService, UiSelectButtonsDirective, UiTabsDirective, UiTimeDropdownDirective, UiValidationErrorsDirective, UiYearlyCalendarDirective, createNavigation, createUrl, createUrlTree, emptyCountry, extractParam, getAspectRatioFit, isBrowser, navigateByUrl, stringToColorGradient, stringToHslColor };
|
|
4269
4374
|
//# sourceMappingURL=ibragim-dev-org-ui-forge-library.mjs.map
|