intelica-library-ui 0.1.100 → 0.1.102
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,8 +1,8 @@
|
|
|
1
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
3
|
import { inject, Injectable, signal, Pipe, Component, HostListener, Directive, EventEmitter, Output, Input, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild, PLATFORM_ID, Inject } from '@angular/core';
|
|
3
|
-
import { getCookie, Cookies, setCookie } from 'typescript-cookie';
|
|
4
|
-
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
5
4
|
import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription } from 'rxjs';
|
|
5
|
+
import { getCookie, Cookies, setCookie } from 'typescript-cookie';
|
|
6
6
|
import Swal from 'sweetalert2';
|
|
7
7
|
import * as i1 from '@angular/common';
|
|
8
8
|
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
|
@@ -40,6 +40,26 @@ import JSEncrypt from 'jsencrypt';
|
|
|
40
40
|
import Aura from '@primeng/themes/aura';
|
|
41
41
|
import { definePreset } from '@primeng/themes';
|
|
42
42
|
|
|
43
|
+
// import { CookieAttributes } from "typescript-cookie/dist/types";
|
|
44
|
+
const domain = window.location.hostname.split(".").slice(-2).join(".");
|
|
45
|
+
const secure = !domain.includes("localhost");
|
|
46
|
+
const CookieAttributesGeneral = { domain: domain, path: "/", secure: secure };
|
|
47
|
+
|
|
48
|
+
const Color = {
|
|
49
|
+
mastercard: "#ff7f00",
|
|
50
|
+
visa: "#17375E",
|
|
51
|
+
amex: "#348AD5",
|
|
52
|
+
orange: "#ff7f00",
|
|
53
|
+
orangeDark: "#CC4900",
|
|
54
|
+
blue: "#17375E",
|
|
55
|
+
gray: "#D3D3D3",
|
|
56
|
+
gray3: "#a6a5a1",
|
|
57
|
+
gray5: "#e9e9e9",
|
|
58
|
+
};
|
|
59
|
+
const getColor = (name) => {
|
|
60
|
+
return Color[name];
|
|
61
|
+
};
|
|
62
|
+
|
|
43
63
|
class ConfigService {
|
|
44
64
|
Http = inject(HttpClient);
|
|
45
65
|
environment;
|
|
@@ -72,108 +92,6 @@ function InitializeConfigService(confg) {
|
|
|
72
92
|
return () => confg.init();
|
|
73
93
|
}
|
|
74
94
|
|
|
75
|
-
class TermService {
|
|
76
|
-
_http = inject(HttpClient);
|
|
77
|
-
_config = inject(ConfigService);
|
|
78
|
-
GetTerms(languageCode, pageRoot) {
|
|
79
|
-
return this._http.get(`${this._config.environment?.configurationPath}/TermPage/GetPageTerm/${languageCode}/${pageRoot}`);
|
|
80
|
-
}
|
|
81
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
82
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, providedIn: "root" });
|
|
83
|
-
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, decorators: [{
|
|
85
|
-
type: Injectable,
|
|
86
|
-
args: [{ providedIn: "root" }]
|
|
87
|
-
}] });
|
|
88
|
-
|
|
89
|
-
class GlobalTermService {
|
|
90
|
-
terms = [];
|
|
91
|
-
languageCode = "";
|
|
92
|
-
TermsReady = signal(false);
|
|
93
|
-
PageRoot = "";
|
|
94
|
-
termService = inject(TermService);
|
|
95
|
-
Initialize(pageRoot) {
|
|
96
|
-
let languageCode = getCookie("language") ?? "EN";
|
|
97
|
-
this.PageRoot = pageRoot;
|
|
98
|
-
if (pageRoot == "") {
|
|
99
|
-
this.TermsReady.set(true);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this.termService.GetTerms(languageCode, pageRoot).subscribe(response => {
|
|
103
|
-
this.terms = response;
|
|
104
|
-
this.TermsReady.set(true);
|
|
105
|
-
this.SetTerms();
|
|
106
|
-
this.languageCode = languageCode;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
async SetTerms() {
|
|
110
|
-
while (true) {
|
|
111
|
-
await sleep$1(10);
|
|
112
|
-
if (document.querySelectorAll("[data-term]").length > 1)
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
let textsToChange = document.querySelectorAll("[data-term]");
|
|
116
|
-
textsToChange.forEach(async (element) => {
|
|
117
|
-
let dataValue = element.getAttribute("data-term");
|
|
118
|
-
let newText = this.terms.find(x => x.termName == dataValue)?.termValue ?? "";
|
|
119
|
-
element.innerHTML = newText;
|
|
120
|
-
element.setAttribute("placeholder", newText);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GlobalTermService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
124
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GlobalTermService, providedIn: "root" });
|
|
125
|
-
}
|
|
126
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GlobalTermService, decorators: [{
|
|
127
|
-
type: Injectable,
|
|
128
|
-
args: [{ providedIn: "root" }]
|
|
129
|
-
}] });
|
|
130
|
-
function sleep$1(ms) {
|
|
131
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// import GlobalTermService from "../services/globalTerm.service";
|
|
135
|
-
class TermPipe {
|
|
136
|
-
globalTermService = inject(GlobalTermService);
|
|
137
|
-
transform(termName, language, mode = 1) {
|
|
138
|
-
let term = this.globalTermService.terms.find(x => x.termName == termName)?.termValue ?? "-";
|
|
139
|
-
if (mode == 2)
|
|
140
|
-
term = term.substring(0, 1);
|
|
141
|
-
if (mode == 3)
|
|
142
|
-
term = term.toUpperCase();
|
|
143
|
-
return term;
|
|
144
|
-
}
|
|
145
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
146
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: TermPipe, isStandalone: true, name: "term" });
|
|
147
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermPipe, providedIn: "root" });
|
|
148
|
-
}
|
|
149
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermPipe, decorators: [{
|
|
150
|
-
type: Injectable,
|
|
151
|
-
args: [{ providedIn: "root" }]
|
|
152
|
-
}, {
|
|
153
|
-
type: Pipe,
|
|
154
|
-
args: [{ name: "term" }]
|
|
155
|
-
}] });
|
|
156
|
-
|
|
157
|
-
// import { CookieAttributes } from "typescript-cookie/dist/types";
|
|
158
|
-
const domain = window.location.hostname.split(".").slice(-2).join(".");
|
|
159
|
-
const secure = !domain.includes("localhost");
|
|
160
|
-
const CookieAttributesGeneral = { domain: domain, path: "/", secure: secure };
|
|
161
|
-
|
|
162
|
-
const Color = {
|
|
163
|
-
mastercard: "#ff7f00",
|
|
164
|
-
visa: "#17375E",
|
|
165
|
-
amex: "#348AD5",
|
|
166
|
-
orange: "#ff7f00",
|
|
167
|
-
orangeDark: "#CC4900",
|
|
168
|
-
blue: "#17375E",
|
|
169
|
-
gray: "#D3D3D3",
|
|
170
|
-
gray3: "#a6a5a1",
|
|
171
|
-
gray5: "#e9e9e9",
|
|
172
|
-
};
|
|
173
|
-
const getColor = (name) => {
|
|
174
|
-
return Color[name];
|
|
175
|
-
};
|
|
176
|
-
|
|
177
95
|
class FeatureFlagService {
|
|
178
96
|
_http = inject(HttpClient);
|
|
179
97
|
_configService = inject(ConfigService);
|
|
@@ -391,7 +309,7 @@ class PermissionsService {
|
|
|
391
309
|
constructor() { }
|
|
392
310
|
async canActivate(next, state) {
|
|
393
311
|
while (true) {
|
|
394
|
-
await sleep(10);
|
|
312
|
+
await sleep$1(10);
|
|
395
313
|
if (document.querySelectorAll("[data-security]").length > 0)
|
|
396
314
|
break;
|
|
397
315
|
}
|
|
@@ -417,7 +335,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
417
335
|
providedIn: "root",
|
|
418
336
|
}]
|
|
419
337
|
}], ctorParameters: () => [] });
|
|
420
|
-
function sleep(ms) {
|
|
338
|
+
function sleep$1(ms) {
|
|
421
339
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
422
340
|
}
|
|
423
341
|
const TermGuard = (next, state) => {
|
|
@@ -425,6 +343,166 @@ const TermGuard = (next, state) => {
|
|
|
425
343
|
return true;
|
|
426
344
|
};
|
|
427
345
|
|
|
346
|
+
class TermService {
|
|
347
|
+
_http = inject(HttpClient);
|
|
348
|
+
_config = inject(ConfigService);
|
|
349
|
+
GetTerms(languageCode, pageRoot) {
|
|
350
|
+
return this._http.get(`${this._config.environment?.configurationPath}/TermPage/GetPageTerm/${languageCode}/${pageRoot}`);
|
|
351
|
+
}
|
|
352
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
353
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, providedIn: "root" });
|
|
354
|
+
}
|
|
355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, decorators: [{
|
|
356
|
+
type: Injectable,
|
|
357
|
+
args: [{ providedIn: "root" }]
|
|
358
|
+
}] });
|
|
359
|
+
|
|
360
|
+
class GlobalTermService {
|
|
361
|
+
terms = [];
|
|
362
|
+
languageCode = "";
|
|
363
|
+
TermsReady = signal(false);
|
|
364
|
+
PageRoot = "";
|
|
365
|
+
termService = inject(TermService);
|
|
366
|
+
Initialize(pageRoot) {
|
|
367
|
+
let languageCode = getCookie("language") ?? "EN";
|
|
368
|
+
this.PageRoot = pageRoot;
|
|
369
|
+
if (pageRoot == "") {
|
|
370
|
+
this.TermsReady.set(true);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
this.termService.GetTerms(languageCode, pageRoot).subscribe(response => {
|
|
374
|
+
this.terms = response;
|
|
375
|
+
this.TermsReady.set(true);
|
|
376
|
+
this.SetTerms();
|
|
377
|
+
this.languageCode = languageCode;
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
async SetTerms() {
|
|
381
|
+
while (true) {
|
|
382
|
+
await sleep(10);
|
|
383
|
+
if (document.querySelectorAll("[data-term]").length > 1)
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
let textsToChange = document.querySelectorAll("[data-term]");
|
|
387
|
+
textsToChange.forEach(async (element) => {
|
|
388
|
+
let dataValue = element.getAttribute("data-term");
|
|
389
|
+
let newText = this.terms.find(x => x.termName == dataValue)?.termValue ?? "";
|
|
390
|
+
element.innerHTML = newText;
|
|
391
|
+
element.setAttribute("placeholder", newText);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GlobalTermService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
395
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GlobalTermService, providedIn: "root" });
|
|
396
|
+
}
|
|
397
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: GlobalTermService, decorators: [{
|
|
398
|
+
type: Injectable,
|
|
399
|
+
args: [{ providedIn: "root" }]
|
|
400
|
+
}] });
|
|
401
|
+
function sleep(ms) {
|
|
402
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// import GlobalTermService from "../services/globalTerm.service";
|
|
406
|
+
class TermPipe {
|
|
407
|
+
globalTermService = inject(GlobalTermService);
|
|
408
|
+
transform(termName, language, mode = 1) {
|
|
409
|
+
let term = this.globalTermService.terms.find(x => x.termName == termName)?.termValue ?? "-";
|
|
410
|
+
if (mode == 2)
|
|
411
|
+
term = term.substring(0, 1);
|
|
412
|
+
if (mode == 3)
|
|
413
|
+
term = term.toUpperCase();
|
|
414
|
+
return term;
|
|
415
|
+
}
|
|
416
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
417
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: TermPipe, isStandalone: true, name: "term" });
|
|
418
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermPipe, providedIn: "root" });
|
|
419
|
+
}
|
|
420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermPipe, decorators: [{
|
|
421
|
+
type: Injectable,
|
|
422
|
+
args: [{ providedIn: "root" }]
|
|
423
|
+
}, {
|
|
424
|
+
type: Pipe,
|
|
425
|
+
args: [{ name: "term" }]
|
|
426
|
+
}] });
|
|
427
|
+
|
|
428
|
+
class FormatAmountPipe {
|
|
429
|
+
transform(value, shortFormat = false, decimalPlaces = 2) {
|
|
430
|
+
if (value === null || value === undefined) {
|
|
431
|
+
return "0";
|
|
432
|
+
}
|
|
433
|
+
const numericValue = typeof value === "string" ? parseFloat(value) : value;
|
|
434
|
+
if (isNaN(numericValue)) {
|
|
435
|
+
return "0";
|
|
436
|
+
}
|
|
437
|
+
let formattedValue;
|
|
438
|
+
if (shortFormat) {
|
|
439
|
+
formattedValue = this.getShortFormat(numericValue, decimalPlaces);
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
formattedValue = this.formatWithThousandSeparators(numericValue, decimalPlaces);
|
|
443
|
+
}
|
|
444
|
+
return formattedValue;
|
|
445
|
+
}
|
|
446
|
+
getShortFormat(value, decimalPlaces) {
|
|
447
|
+
const absValue = Math.abs(value);
|
|
448
|
+
const suffixes = [
|
|
449
|
+
{ limit: 1e12, suffix: "T" },
|
|
450
|
+
{ limit: 1e9, suffix: "B" },
|
|
451
|
+
{ limit: 1e6, suffix: "M" },
|
|
452
|
+
{ limit: 1e3, suffix: "K" },
|
|
453
|
+
];
|
|
454
|
+
for (const { limit, suffix } of suffixes) {
|
|
455
|
+
if (absValue >= limit) {
|
|
456
|
+
return (value / limit).toFixed(decimalPlaces) + suffix;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return value.toFixed(decimalPlaces);
|
|
460
|
+
}
|
|
461
|
+
formatWithThousandSeparators(value, decimalPlaces) {
|
|
462
|
+
return new Intl.NumberFormat("en-US", {
|
|
463
|
+
minimumFractionDigits: decimalPlaces,
|
|
464
|
+
maximumFractionDigits: decimalPlaces,
|
|
465
|
+
}).format(value);
|
|
466
|
+
}
|
|
467
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatAmountPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
468
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: FormatAmountPipe, isStandalone: true, name: "amount" });
|
|
469
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatAmountPipe, providedIn: "root" });
|
|
470
|
+
}
|
|
471
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FormatAmountPipe, decorators: [{
|
|
472
|
+
type: Injectable,
|
|
473
|
+
args: [{
|
|
474
|
+
providedIn: "root",
|
|
475
|
+
}]
|
|
476
|
+
}, {
|
|
477
|
+
type: Pipe,
|
|
478
|
+
args: [{
|
|
479
|
+
name: "amount",
|
|
480
|
+
}]
|
|
481
|
+
}] });
|
|
482
|
+
|
|
483
|
+
class TruncatePipe {
|
|
484
|
+
transform(value, size = 15, original = false) {
|
|
485
|
+
if (!value)
|
|
486
|
+
return value;
|
|
487
|
+
if (value.length <= size)
|
|
488
|
+
return value;
|
|
489
|
+
let truncateString = value.substring(0, size);
|
|
490
|
+
return !original ? `${truncateString}...` : truncateString.toUpperCase();
|
|
491
|
+
}
|
|
492
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
493
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: TruncatePipe, isStandalone: true, name: "truncate" });
|
|
494
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TruncatePipe, providedIn: "root" });
|
|
495
|
+
}
|
|
496
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TruncatePipe, decorators: [{
|
|
497
|
+
type: Injectable,
|
|
498
|
+
args: [{ providedIn: "root" }]
|
|
499
|
+
}, {
|
|
500
|
+
type: Pipe,
|
|
501
|
+
args: [{
|
|
502
|
+
name: "truncate",
|
|
503
|
+
}]
|
|
504
|
+
}] });
|
|
505
|
+
|
|
428
506
|
class SpinnerComponent {
|
|
429
507
|
spinerService = inject(SpinnerService);
|
|
430
508
|
isLoading = this.spinerService.isLoading;
|
|
@@ -6052,5 +6130,5 @@ const IntelicaTheme = definePreset(Aura, {
|
|
|
6052
6130
|
* Generated bundle index. Do not edit.
|
|
6053
6131
|
*/
|
|
6054
6132
|
|
|
6055
|
-
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DynamicInputValidation, EchartComponent, EchartService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaTheme, ItemSplitDirective, LanguageService, ModalDialogComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RowResumenComponent, SearchComponent, SharedService, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TemplateMenuComponent, TermGuard, TermPipe, TermService, decryptData, encryptData, getColor };
|
|
6133
|
+
export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DynamicInputValidation, EchartComponent, EchartService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FormatAmountPipe, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaTheme, ItemSplitDirective, LanguageService, ModalDialogComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RowResumenComponent, SearchComponent, SharedService, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TemplateMenuComponent, TermGuard, TermPipe, TermService, TruncatePipe, decryptData, encryptData, getColor };
|
|
6056
6134
|
//# sourceMappingURL=intelica-library-ui.mjs.map
|