@ibragim-dev-org/ui-forge-library 1.4.0 → 1.4.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.
|
@@ -7,10 +7,10 @@ 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 {
|
|
@@ -795,7 +795,7 @@ function getAspectRatioFit(maxWidth, maxHeight, srcWidth, srcHeight) {
|
|
|
795
795
|
return { width: maxWidth, height: maxHeight };
|
|
796
796
|
}
|
|
797
797
|
|
|
798
|
-
const
|
|
798
|
+
const COLORS = [
|
|
799
799
|
// Reds
|
|
800
800
|
{ solid: '#FF7A7A', gradientStart: '#FF7A7A', gradientEnd: '#D74A59' },
|
|
801
801
|
{ solid: '#FF6C6C', gradientStart: '#FF6C6C', gradientEnd: '#D64545' },
|
|
@@ -841,6 +841,23 @@ const COLOR_FAMILIES = [
|
|
|
841
841
|
// Magenta
|
|
842
842
|
{ solid: '#FF7BD9', gradientStart: '#FF7BD9', gradientEnd: '#E054B9' },
|
|
843
843
|
];
|
|
844
|
+
function seededRandom(seed) {
|
|
845
|
+
return () => {
|
|
846
|
+
seed = (seed * 9301 + 49297) % 233280;
|
|
847
|
+
return seed / 233280;
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
function seededShuffle(arr, seed = 1337) {
|
|
851
|
+
const random = seededRandom(seed);
|
|
852
|
+
const copy = [...arr];
|
|
853
|
+
for (let i = copy.length - 1; i > 0; i--) {
|
|
854
|
+
const j = Math.floor(random() * (i + 1));
|
|
855
|
+
[copy[i], copy[j]] = [copy[j], copy[i]];
|
|
856
|
+
}
|
|
857
|
+
return copy;
|
|
858
|
+
}
|
|
859
|
+
// Shuffled palette for this session
|
|
860
|
+
const SHUFFLED_COLORS = seededShuffle(COLORS, 20240612);
|
|
844
861
|
const hashValue = (value) => {
|
|
845
862
|
if (!value || typeof value !== 'string') {
|
|
846
863
|
return 0;
|
|
@@ -854,7 +871,7 @@ const hashValue = (value) => {
|
|
|
854
871
|
};
|
|
855
872
|
const pickColorFamily = (value) => {
|
|
856
873
|
const absHash = hashValue(value);
|
|
857
|
-
return
|
|
874
|
+
return SHUFFLED_COLORS[absHash % SHUFFLED_COLORS.length];
|
|
858
875
|
};
|
|
859
876
|
const hexToRgb = (hex) => {
|
|
860
877
|
const value = hex.replace('#', '');
|
|
@@ -1224,16 +1241,54 @@ class Alert {
|
|
|
1224
1241
|
}
|
|
1225
1242
|
}
|
|
1226
1243
|
|
|
1227
|
-
class
|
|
1244
|
+
class UiAlertMessagesOverlayService {
|
|
1228
1245
|
overlay;
|
|
1246
|
+
component = null;
|
|
1247
|
+
overlayRef;
|
|
1248
|
+
constructor(component, overlay) {
|
|
1249
|
+
this.overlay = overlay;
|
|
1250
|
+
this.init(component);
|
|
1251
|
+
}
|
|
1252
|
+
attachComponent() {
|
|
1253
|
+
if (!this.component) {
|
|
1254
|
+
this.throwIfNotInitialized();
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
const strategy = this.overlay.position().global();
|
|
1258
|
+
const config = new OverlayConfig({
|
|
1259
|
+
positionStrategy: strategy,
|
|
1260
|
+
});
|
|
1261
|
+
this.overlayRef = this.overlay.create(config);
|
|
1262
|
+
this.overlayRef.attach(new ComponentPortal(this.component));
|
|
1263
|
+
}
|
|
1264
|
+
init(component) {
|
|
1265
|
+
this.component = component;
|
|
1266
|
+
}
|
|
1267
|
+
throwIfNotInitialized() {
|
|
1268
|
+
if (!this.component) {
|
|
1269
|
+
throw new Error('[UiAlertMessagesOverlayService] AlertMessagesComponent has not been initialized. ' +
|
|
1270
|
+
'Call `init(AlertMessagesComponent)` during application startup (e.g. in `app.config.ts`) to enable alert rendering.');
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
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 });
|
|
1274
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesOverlayService, providedIn: 'root' });
|
|
1275
|
+
}
|
|
1276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesOverlayService, decorators: [{
|
|
1277
|
+
type: Injectable,
|
|
1278
|
+
args: [{
|
|
1279
|
+
providedIn: 'root',
|
|
1280
|
+
}]
|
|
1281
|
+
}], ctorParameters: () => [{ type: i0.Type }, { type: i1.Overlay }] });
|
|
1282
|
+
|
|
1283
|
+
class UiAlertMessagesService {
|
|
1284
|
+
uiAlertMessagesOverlayService;
|
|
1229
1285
|
router;
|
|
1230
1286
|
$alerts = signal([], ...(ngDevMode ? [{ debugName: "$alerts" }] : []));
|
|
1231
1287
|
overlayRef;
|
|
1232
|
-
component = null;
|
|
1233
1288
|
timerSubscriptions = new Map();
|
|
1234
1289
|
timerState = new Map();
|
|
1235
|
-
constructor(
|
|
1236
|
-
this.
|
|
1290
|
+
constructor(uiAlertMessagesOverlayService, router) {
|
|
1291
|
+
this.uiAlertMessagesOverlayService = uiAlertMessagesOverlayService;
|
|
1237
1292
|
this.router = router;
|
|
1238
1293
|
}
|
|
1239
1294
|
success(params) {
|
|
@@ -1314,22 +1369,13 @@ class UiAlertMessagesService {
|
|
|
1314
1369
|
}))
|
|
1315
1370
|
.subscribe();
|
|
1316
1371
|
}
|
|
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
1372
|
open(alert) {
|
|
1327
|
-
if (!this.component) {
|
|
1328
|
-
|
|
1329
|
-
|
|
1373
|
+
if (!this.uiAlertMessagesOverlayService.component) {
|
|
1374
|
+
this.uiAlertMessagesOverlayService.throwIfNotInitialized();
|
|
1375
|
+
return;
|
|
1330
1376
|
}
|
|
1331
1377
|
if (!this.$alerts().length) {
|
|
1332
|
-
this.
|
|
1378
|
+
this.uiAlertMessagesOverlayService.attachComponent();
|
|
1333
1379
|
}
|
|
1334
1380
|
this.router.events
|
|
1335
1381
|
.pipe(filter((v) => v instanceof NavigationEnd), tap(() => {
|
|
@@ -1355,7 +1401,7 @@ class UiAlertMessagesService {
|
|
|
1355
1401
|
.subscribe();
|
|
1356
1402
|
this.timerSubscriptions.set(alert.id, subscription);
|
|
1357
1403
|
}
|
|
1358
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, deps: [{ token:
|
|
1404
|
+
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
1405
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, providedIn: 'root' });
|
|
1360
1406
|
}
|
|
1361
1407
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAlertMessagesService, decorators: [{
|
|
@@ -1363,7 +1409,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
1363
1409
|
args: [{
|
|
1364
1410
|
providedIn: 'root',
|
|
1365
1411
|
}]
|
|
1366
|
-
}], ctorParameters: () => [{ type:
|
|
1412
|
+
}], ctorParameters: () => [{ type: UiAlertMessagesOverlayService }, { type: i2$1.Router }] });
|
|
1367
1413
|
|
|
1368
1414
|
const avatarSizes = ['small', 'medium', 'large'];
|
|
1369
1415
|
class UiAvatarDirective {
|
|
@@ -1385,7 +1431,7 @@ class UiAvatarDirective {
|
|
|
1385
1431
|
.slice(0, 2)
|
|
1386
1432
|
.map((word) => word[0]?.toUpperCase() || '')
|
|
1387
1433
|
.join('');
|
|
1388
|
-
const colorValue = acronym
|
|
1434
|
+
const colorValue = this.$acronym();
|
|
1389
1435
|
this.renderer.setStyle(this.elementRef.nativeElement, 'background', stringToColorGradient(colorValue));
|
|
1390
1436
|
this.$text.set(acronym);
|
|
1391
1437
|
});
|
|
@@ -1973,25 +2019,42 @@ class UiPopupInstance {
|
|
|
1973
2019
|
}
|
|
1974
2020
|
}
|
|
1975
2021
|
|
|
2022
|
+
class UiPopupBackdropService {
|
|
2023
|
+
tipContainerPortal;
|
|
2024
|
+
backdropPortal;
|
|
2025
|
+
constructor(component, tipComponent) {
|
|
2026
|
+
this.backdropPortal = new ComponentPortal(component);
|
|
2027
|
+
if (tipComponent) {
|
|
2028
|
+
this.tipContainerPortal = new ComponentPortal(tipComponent);
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
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 });
|
|
2032
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, providedIn: 'root' });
|
|
2033
|
+
}
|
|
2034
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, decorators: [{
|
|
2035
|
+
type: Injectable,
|
|
2036
|
+
args: [{
|
|
2037
|
+
providedIn: 'root',
|
|
2038
|
+
}]
|
|
2039
|
+
}], ctorParameters: () => [{ type: i0.Type }, { type: i0.Type }] });
|
|
2040
|
+
|
|
1976
2041
|
class UiPopupService {
|
|
1977
2042
|
overlay;
|
|
1978
2043
|
injector;
|
|
1979
2044
|
destroyRef;
|
|
1980
2045
|
router;
|
|
2046
|
+
backdropService;
|
|
1981
2047
|
popupInstances = [];
|
|
1982
2048
|
backdropRef;
|
|
1983
|
-
backdropPortal;
|
|
1984
2049
|
backdropPortalRef;
|
|
1985
2050
|
destroyDownloading$ = new Subject();
|
|
1986
2051
|
destroyOutsideClickSubscription$ = new Subject();
|
|
1987
|
-
constructor(overlay, injector, destroyRef, router) {
|
|
2052
|
+
constructor(overlay, injector, destroyRef, router, backdropService) {
|
|
1988
2053
|
this.overlay = overlay;
|
|
1989
2054
|
this.injector = injector;
|
|
1990
2055
|
this.destroyRef = destroyRef;
|
|
1991
2056
|
this.router = router;
|
|
1992
|
-
|
|
1993
|
-
init(component) {
|
|
1994
|
-
this.backdropPortal = new ComponentPortal(component);
|
|
2057
|
+
this.backdropService = backdropService;
|
|
1995
2058
|
}
|
|
1996
2059
|
/**
|
|
1997
2060
|
* Opens a popup with the specified component and options.
|
|
@@ -2140,7 +2203,11 @@ class UiPopupService {
|
|
|
2140
2203
|
positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
|
|
2141
2204
|
scrollStrategy: this.overlay.scrollStrategies.noop(),
|
|
2142
2205
|
});
|
|
2143
|
-
|
|
2206
|
+
if (!this.backdropService.backdropPortal) {
|
|
2207
|
+
throw new Error('[UiPopupService] UiPopupBackdropService has not been initialized. ' +
|
|
2208
|
+
'inject(UiPopupBackdropService) during application startup (e.g. in `app.config.ts`) to enable popup rendering.');
|
|
2209
|
+
}
|
|
2210
|
+
this.backdropPortalRef = this.backdropRef.attach(this.backdropService.backdropPortal);
|
|
2144
2211
|
if (this.backdropPortalRef) {
|
|
2145
2212
|
this.backdropPortalRef.location.nativeElement.classList.add('animate-in');
|
|
2146
2213
|
this.backdropPortalRef.setInput('isStaticBackdrop', isStaticBackdrop);
|
|
@@ -2202,7 +2269,7 @@ class UiPopupService {
|
|
|
2202
2269
|
endTransition: 'scale(1)',
|
|
2203
2270
|
};
|
|
2204
2271
|
}
|
|
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 });
|
|
2272
|
+
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
2273
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, providedIn: 'root' });
|
|
2207
2274
|
}
|
|
2208
2275
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, decorators: [{
|
|
@@ -2210,7 +2277,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
2210
2277
|
args: [{
|
|
2211
2278
|
providedIn: 'root',
|
|
2212
2279
|
}]
|
|
2213
|
-
}], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.Injector }, { type: i0.DestroyRef }, { type: i2$1.Router }] });
|
|
2280
|
+
}], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.Injector }, { type: i0.DestroyRef }, { type: i2$1.Router }, { type: UiPopupBackdropService }] });
|
|
2214
2281
|
|
|
2215
2282
|
class UiPopupContainerDirective {
|
|
2216
2283
|
popupInstance;
|
|
@@ -2318,7 +2385,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
2318
2385
|
}] }, { 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
2386
|
|
|
2320
2387
|
class UiDropdownService extends UiPopupService {
|
|
2321
|
-
tipContainerPortal;
|
|
2322
2388
|
containerSize$ = new BehaviorSubject({
|
|
2323
2389
|
width: 0,
|
|
2324
2390
|
height: 0,
|
|
@@ -2424,12 +2490,6 @@ class UiDropdownService extends UiPopupService {
|
|
|
2424
2490
|
},
|
|
2425
2491
|
},
|
|
2426
2492
|
};
|
|
2427
|
-
init(component, tipComponent) {
|
|
2428
|
-
super.init(component);
|
|
2429
|
-
if (tipComponent) {
|
|
2430
|
-
this.tipContainerPortal = new ComponentPortal(tipComponent);
|
|
2431
|
-
}
|
|
2432
|
-
}
|
|
2433
2493
|
/**
|
|
2434
2494
|
* Opens a tooltip (tip) component attached to a specific HTML element.
|
|
2435
2495
|
* The tooltip displays text content with customizable position and offset.
|
|
@@ -2445,11 +2505,11 @@ class UiDropdownService extends UiPopupService {
|
|
|
2445
2505
|
*
|
|
2446
2506
|
*/
|
|
2447
2507
|
openTip(text, attachedRef, id, position = 'top', offsetY = 0, offsetX = 0) {
|
|
2448
|
-
if (!this.tipContainerPortal) {
|
|
2449
|
-
|
|
2450
|
-
|
|
2508
|
+
if (!this.backdropService.tipContainerPortal) {
|
|
2509
|
+
throw new Error('[UiDropdownService] Tip component is not defined. ' +
|
|
2510
|
+
'inject(UiPopupBackdropService) during application startup (e.g. in `app.config.ts`) to enable tip rendering.');
|
|
2451
2511
|
}
|
|
2452
|
-
const tipComponent = this.tipContainerPortal?.component;
|
|
2512
|
+
const tipComponent = this.backdropService.tipContainerPortal?.component;
|
|
2453
2513
|
if (tipComponent) {
|
|
2454
2514
|
this.openAttached(tipComponent, attachedRef, id, {
|
|
2455
2515
|
options: {
|
|
@@ -4265,5 +4325,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
4265
4325
|
* Generated bundle index. Do not edit.
|
|
4266
4326
|
*/
|
|
4267
4327
|
|
|
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 };
|
|
4328
|
+
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, navigateByUrl, stringToColorGradient, stringToHslColor };
|
|
4269
4329
|
//# sourceMappingURL=ibragim-dev-org-ui-forge-library.mjs.map
|