@pepperi-addons/ngx-lib 0.4.2-beta.98 → 0.4.2-scroll.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.
- package/chips/chips.component.d.ts +1 -3
- package/core/common/pipes/common-pipes.d.ts +3 -0
- package/core/customization/customization.model.d.ts +1 -1
- package/esm2020/checkbox/checkbox.component.mjs +3 -3
- package/esm2020/chips/chips.component.mjs +8 -11
- package/esm2020/color/color.component.mjs +3 -3
- package/esm2020/core/common/pipes/common-pipes.mjs +14 -4
- package/esm2020/core/customization/customization.model.mjs +7 -1
- package/esm2020/core/customization/customization.service.mjs +2 -1
- package/esm2020/core/http/services/loader.service.mjs +3 -3
- package/esm2020/draggable-items/draggable-items.component.mjs +3 -3
- package/esm2020/form/field-generator.component.mjs +3 -3
- package/esm2020/form/form.component.mjs +3 -3
- package/esm2020/form/internal-carusel.component.mjs +10 -6
- package/esm2020/form/internal-field-generator.component.mjs +3 -3
- package/esm2020/form/internal-form.component.mjs +3 -3
- package/esm2020/form/internal-menu.component.mjs +4 -6
- package/esm2020/form/internal-page.component.mjs +3 -4
- package/esm2020/image/image.component.mjs +3 -3
- package/esm2020/images-filmstrip/images-filmstrip.component.mjs +3 -3
- package/esm2020/link/link.component.mjs +9 -3
- package/esm2020/list/list-actions.component.mjs +1 -1
- package/esm2020/list/list-chooser.component.mjs +1 -1
- package/esm2020/list/list-sorting.component.mjs +1 -1
- package/esm2020/list/list-views.component.mjs +1 -1
- package/esm2020/list/list.component.mjs +22 -10
- package/esm2020/list/list.model.mjs +1 -1
- package/esm2020/menu/menu-item.component.mjs +3 -3
- package/esm2020/menu/menu.component.mjs +6 -3
- package/esm2020/menu/menu.model.mjs +2 -1
- package/esm2020/profile-data-views-list/profile-data-view/profile-data-view.component.mjs +1 -1
- package/esm2020/profile-data-views-list/profile-data-views-card/profile-data-views-card.component.mjs +25 -9
- package/esm2020/profile-data-views-list/profile-data-views-list.component.mjs +58 -26
- package/esm2020/profile-data-views-list/profile-data-views-list.model.mjs +1 -1
- package/esm2020/quantity-selector/quantity-selector.component.mjs +7 -3
- package/esm2020/query-builder/common/model/legacy.mjs +1 -1
- package/esm2020/query-builder/common/model/operator.mjs +72 -62
- package/esm2020/query-builder/common/services/output-query.service.mjs +5 -3
- package/esm2020/query-builder/common/services/query-structure.service.mjs +24 -1
- package/esm2020/query-builder/query-builder-item/query-builder-item.component.mjs +3 -3
- package/esm2020/query-builder/query-builder-section/query-builder-section.component.mjs +3 -3
- package/esm2020/query-builder/query-builder.module.mjs +14 -3
- package/esm2020/query-builder/query-builder.service.mjs +2 -2
- package/esm2020/remote-loader/remote-loader.service.mjs +16 -16
- package/esm2020/rich-html-textarea/rich-html-textarea.component.mjs +10 -3
- package/esm2020/select/select.component.mjs +3 -3
- package/esm2020/select-panel/select-panel.component.mjs +3 -5
- package/esm2020/signature/signature-dialog.component.mjs +2 -1
- package/esm2020/signature/signature.component.mjs +4 -4
- package/esm2020/skeleton-loader/public-api.mjs +2 -2
- package/esm2020/skeleton-loader/skeleton-loader.component.mjs +3 -3
- package/esm2020/smart-filters/common/model/operator.mjs +11 -4
- package/esm2020/smart-filters/common/model/type.mjs +1 -1
- package/esm2020/smart-filters/multi-select-filter/multi-select-filter.component.mjs +3 -3
- package/esm2020/smart-filters/text-filter/text-filter.component.mjs +3 -3
- package/esm2020/textbox/textbox.component.mjs +26 -6
- package/fesm2015/pepperi-addons-ngx-lib-checkbox.mjs +2 -2
- package/fesm2015/pepperi-addons-ngx-lib-checkbox.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-chips.mjs +7 -10
- package/fesm2015/pepperi-addons-ngx-lib-chips.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-color.mjs +2 -2
- package/fesm2015/pepperi-addons-ngx-lib-color.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-draggable-items.mjs +2 -2
- package/fesm2015/pepperi-addons-ngx-lib-draggable-items.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-form.mjs +22 -21
- package/fesm2015/pepperi-addons-ngx-lib-form.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-image.mjs +2 -2
- package/fesm2015/pepperi-addons-ngx-lib-image.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.mjs +2 -2
- package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-link.mjs +8 -2
- package/fesm2015/pepperi-addons-ngx-lib-link.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-list.mjs +25 -13
- package/fesm2015/pepperi-addons-ngx-lib-list.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-menu.mjs +8 -4
- package/fesm2015/pepperi-addons-ngx-lib-menu.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-profile-data-views-list.mjs +81 -33
- package/fesm2015/pepperi-addons-ngx-lib-profile-data-views-list.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.mjs +7 -2
- package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-query-builder.mjs +119 -70
- package/fesm2015/pepperi-addons-ngx-lib-query-builder.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-remote-loader.mjs +16 -16
- package/fesm2015/pepperi-addons-ngx-lib-remote-loader.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.mjs +9 -2
- package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-select-panel.mjs +2 -4
- package/fesm2015/pepperi-addons-ngx-lib-select-panel.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-select.mjs +2 -2
- package/fesm2015/pepperi-addons-ngx-lib-select.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-signature.mjs +5 -3
- package/fesm2015/pepperi-addons-ngx-lib-signature.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-skeleton-loader.mjs +3 -3
- package/fesm2015/pepperi-addons-ngx-lib-skeleton-loader.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-smart-filters.mjs +14 -7
- package/fesm2015/pepperi-addons-ngx-lib-smart-filters.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-textbox.mjs +26 -5
- package/fesm2015/pepperi-addons-ngx-lib-textbox.mjs.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib.mjs +547 -532
- package/fesm2015/pepperi-addons-ngx-lib.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-checkbox.mjs +2 -2
- package/fesm2020/pepperi-addons-ngx-lib-checkbox.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-chips.mjs +7 -10
- package/fesm2020/pepperi-addons-ngx-lib-chips.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-color.mjs +2 -2
- package/fesm2020/pepperi-addons-ngx-lib-color.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-draggable-items.mjs +2 -2
- package/fesm2020/pepperi-addons-ngx-lib-draggable-items.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-form.mjs +22 -21
- package/fesm2020/pepperi-addons-ngx-lib-form.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-image.mjs +2 -2
- package/fesm2020/pepperi-addons-ngx-lib-image.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-images-filmstrip.mjs +2 -2
- package/fesm2020/pepperi-addons-ngx-lib-images-filmstrip.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-link.mjs +8 -2
- package/fesm2020/pepperi-addons-ngx-lib-link.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-list.mjs +25 -13
- package/fesm2020/pepperi-addons-ngx-lib-list.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-menu.mjs +8 -4
- package/fesm2020/pepperi-addons-ngx-lib-menu.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-profile-data-views-list.mjs +81 -33
- package/fesm2020/pepperi-addons-ngx-lib-profile-data-views-list.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-quantity-selector.mjs +6 -2
- package/fesm2020/pepperi-addons-ngx-lib-quantity-selector.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-query-builder.mjs +115 -69
- package/fesm2020/pepperi-addons-ngx-lib-query-builder.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-remote-loader.mjs +15 -15
- package/fesm2020/pepperi-addons-ngx-lib-remote-loader.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-rich-html-textarea.mjs +9 -2
- package/fesm2020/pepperi-addons-ngx-lib-rich-html-textarea.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-select-panel.mjs +2 -4
- package/fesm2020/pepperi-addons-ngx-lib-select-panel.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-select.mjs +2 -2
- package/fesm2020/pepperi-addons-ngx-lib-select.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-signature.mjs +4 -3
- package/fesm2020/pepperi-addons-ngx-lib-signature.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-skeleton-loader.mjs +3 -3
- package/fesm2020/pepperi-addons-ngx-lib-skeleton-loader.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-smart-filters.mjs +14 -7
- package/fesm2020/pepperi-addons-ngx-lib-smart-filters.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib-textbox.mjs +25 -5
- package/fesm2020/pepperi-addons-ngx-lib-textbox.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-lib.mjs +544 -529
- package/fesm2020/pepperi-addons-ngx-lib.mjs.map +1 -1
- package/form/internal-carusel.component.d.ts +1 -0
- package/form/internal-menu.component.d.ts +1 -2
- package/link/link.component.d.ts +3 -1
- package/list/list.component.d.ts +1 -1
- package/list/list.model.d.ts +1 -2
- package/menu/menu.component.d.ts +2 -1
- package/menu/menu.model.d.ts +1 -0
- package/package.json +1 -1
- package/profile-data-views-list/profile-data-view/profile-data-view.component.d.ts +3 -3
- package/profile-data-views-list/profile-data-views-card/profile-data-views-card.component.d.ts +5 -4
- package/profile-data-views-list/profile-data-views-list.component.d.ts +13 -10
- package/profile-data-views-list/profile-data-views-list.model.d.ts +8 -0
- package/query-builder/common/model/legacy.d.ts +2 -0
- package/query-builder/common/model/operator.d.ts +11 -1
- package/query-builder/common/services/query-structure.service.d.ts +1 -0
- package/query-builder/query-builder.module.d.ts +7 -3
- package/remote-loader/remote-loader.service.d.ts +1 -1
- package/rich-html-textarea/rich-html-textarea.component.d.ts +3 -1
- package/rich-html-textarea/rich-html-textarea.component.theme.scss +4 -2
- package/select-panel/select-panel.component.d.ts +1 -2
- package/signature/signature-dialog.component.d.ts +1 -1
- package/skeleton-loader/skeleton-loader.component.d.ts +3 -3
- package/smart-filters/boolean-filter/boolean-filter.component.d.ts +1 -0
- package/smart-filters/common/model/operator.d.ts +1 -0
- package/smart-filters/common/model/type.d.ts +1 -1
- package/smart-filters/date-filter/date-filter.component.d.ts +1 -0
- package/smart-filters/multi-select-filter/multi-select-filter.component.d.ts +1 -0
- package/smart-filters/number-filter/number-filter.component.d.ts +1 -0
- package/smart-filters/text-filter/text-filter.component.d.ts +1 -0
- package/src/assets/i18n/de.ngx-lib.json +4 -1
- package/src/assets/i18n/en.ngx-lib.json +7 -1
- package/src/core/style/abstracts/mixins.scss +73 -11
- package/src/core/style/abstracts/variables.scss +1 -1
- package/src/core/style/base/base.scss +5 -3
- package/src/core/style/base/typography.scss +2 -1
- package/src/core/style/components/button.scss +11 -0
- package/src/core/style/components/general.scss +2 -4
- package/textbox/textbox.component.d.ts +2 -0
- package/theming.scss +5 -1
- package/src/assets/images/sail-away.jpg +0 -0
- package/src/core/style/abstracts/AbstractsIntro.stories.mdx +0 -7
|
@@ -6,11 +6,11 @@ import { HttpResponse, HTTP_INTERCEPTORS, HttpHeaders, HttpClientModule } from '
|
|
|
6
6
|
import * as i3 from '@angular/forms';
|
|
7
7
|
import { FormControl, Validators, ReactiveFormsModule, FormBuilder } from '@angular/forms';
|
|
8
8
|
import { throwError, BehaviorSubject, Subject } from 'rxjs';
|
|
9
|
-
import { catchError, filter, distinctUntilChanged, finalize, tap } from 'rxjs/operators';
|
|
9
|
+
import { catchError, debounceTime, filter, distinctUntilChanged, finalize, tap } from 'rxjs/operators';
|
|
10
10
|
import * as i1 from '@ngx-translate/core';
|
|
11
11
|
import { TranslateModule } from '@ngx-translate/core';
|
|
12
|
-
import * as i1$1 from '@angular/platform-browser';
|
|
13
12
|
import { coerceNumberProperty, _isNumberValue } from '@angular/cdk/coercion';
|
|
13
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
14
14
|
import { createCustomElement } from '@angular/elements';
|
|
15
15
|
import * as i6 from '@angular/router';
|
|
16
16
|
import { Router } from '@angular/router';
|
|
@@ -52,7 +52,7 @@ class PepLoaderService {
|
|
|
52
52
|
get onChanged$() {
|
|
53
53
|
return this.showLoaderSubject
|
|
54
54
|
.asObservable()
|
|
55
|
-
.pipe(filter(v => v !== undefined), distinctUntilChanged());
|
|
55
|
+
.pipe(debounceTime(500), filter(v => v !== undefined), distinctUntilChanged());
|
|
56
56
|
}
|
|
57
57
|
showLoaderChanged(show) {
|
|
58
58
|
const eventData = {
|
|
@@ -382,606 +382,614 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
382
382
|
}]
|
|
383
383
|
}], ctorParameters: function () { return [{ type: PepLayoutService }, { type: i0.Renderer2 }, { type: i0.ElementRef }]; } });
|
|
384
384
|
|
|
385
|
-
class
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
class PepUtilitiesService {
|
|
386
|
+
constructor(translate = null) {
|
|
387
|
+
this.translate = translate;
|
|
388
|
+
this.culture = 'en-US';
|
|
389
|
+
this.culture = this.translate?.getBrowserCultureLang() || 'en-US';
|
|
390
|
+
// try {
|
|
391
|
+
// import(`@angular/common/locales/global/${this.culture}`);
|
|
392
|
+
// } catch {}
|
|
393
|
+
}
|
|
394
|
+
prepareNumberToFormat(value, fallbackValue = 0) {
|
|
395
|
+
// If the decimal separator is ',' change it to '.'
|
|
396
|
+
if (value?.length > 0) {
|
|
397
|
+
// If the decimal separator is ',' change it to '.' for let the formatting works.
|
|
398
|
+
value = this.changeDecimalSeparatorWhenItsComma(value);
|
|
399
|
+
// console.log('coerceNumberProperty after change decimal separator value is', value);
|
|
389
400
|
}
|
|
390
|
-
return value;
|
|
401
|
+
return coerceNumberProperty(value, fallbackValue);
|
|
391
402
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
args: [{ name: 'pepCapitalize' }]
|
|
398
|
-
}] });
|
|
399
|
-
class PepEncodePipe {
|
|
400
|
-
transform(value) {
|
|
401
|
-
if (value) {
|
|
402
|
-
const v = btoa(value);
|
|
403
|
-
return v;
|
|
403
|
+
// adapted from https://github.com/sindresorhus/parse-ms.
|
|
404
|
+
// moved to internal function because parse-ms is now pure ESM.
|
|
405
|
+
parseMs(milliseconds) {
|
|
406
|
+
if (typeof milliseconds !== 'number') {
|
|
407
|
+
throw new TypeError('Expected a number');
|
|
404
408
|
}
|
|
405
|
-
return
|
|
409
|
+
return {
|
|
410
|
+
days: Math.trunc(milliseconds / 86400000),
|
|
411
|
+
hours: Math.trunc(milliseconds / 3600000) % 24,
|
|
412
|
+
minutes: Math.trunc(milliseconds / 60000) % 60,
|
|
413
|
+
seconds: Math.trunc(milliseconds / 1000) % 60,
|
|
414
|
+
milliseconds: Math.trunc(milliseconds) % 1000
|
|
415
|
+
};
|
|
406
416
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
// adapted from https://github.com/rafaelrinaldi/add-zero.
|
|
418
|
+
// moved to internal function b/c addZero is unmaintained (7+ years).
|
|
419
|
+
// stripped out negative sign logic since we're already doing it elsewhere.
|
|
420
|
+
addZero(value, digits = 2) {
|
|
421
|
+
digits = digits || 2;
|
|
422
|
+
let str = value.toString();
|
|
423
|
+
let size = 0;
|
|
424
|
+
size = digits - str.length + 1;
|
|
425
|
+
str = new Array(size).join('0').concat(str);
|
|
426
|
+
return str;
|
|
427
|
+
}
|
|
428
|
+
isCurrencyShouldBeOnRight(currencySymbol) {
|
|
429
|
+
let res = false;
|
|
430
|
+
if (currencySymbol == "€" ||
|
|
431
|
+
currencySymbol == "₪" ||
|
|
432
|
+
currencySymbol == "Ft" ||
|
|
433
|
+
currencySymbol == "Kč" ||
|
|
434
|
+
currencySymbol == "руб" ||
|
|
435
|
+
currencySymbol == "zł" ||
|
|
436
|
+
currencySymbol == "kr.") {
|
|
437
|
+
res = true;
|
|
419
438
|
}
|
|
420
|
-
return
|
|
439
|
+
return res;
|
|
421
440
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
441
|
+
cutValueByFractionDigits(value, maxFractionDigits) {
|
|
442
|
+
let res = value;
|
|
443
|
+
maxFractionDigits = maxFractionDigits || 2;
|
|
444
|
+
const decimalSeparator = this.getDecimalSeparator();
|
|
445
|
+
if (value.includes(decimalSeparator)) {
|
|
446
|
+
const valueArr = value.split(decimalSeparator);
|
|
447
|
+
// if (valueArr[1].length < maxFractionDigits) {
|
|
448
|
+
valueArr[1] = valueArr[1].padEnd(maxFractionDigits, '0');
|
|
449
|
+
// }
|
|
450
|
+
res = `${valueArr[0]}${decimalSeparator}${valueArr[1].slice(0, maxFractionDigits)}`;
|
|
451
|
+
}
|
|
452
|
+
return res;
|
|
433
453
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
+
parseDate(dateStr, showTime = false) {
|
|
455
|
+
let retVal = null;
|
|
456
|
+
if (dateStr !== '') {
|
|
457
|
+
retVal = new Date(dateStr);
|
|
458
|
+
// Convert to date with no offset.
|
|
459
|
+
if (!showTime) {
|
|
460
|
+
const index = dateStr.indexOf('T');
|
|
461
|
+
if (index > 0) {
|
|
462
|
+
dateStr = dateStr.substring(0, index);
|
|
463
|
+
}
|
|
464
|
+
const dateText = dateStr.split('-');
|
|
465
|
+
if (dateText.length === 3) {
|
|
466
|
+
const year = Number(dateText[0]);
|
|
467
|
+
const month = Number(dateText[1]) - 1;
|
|
468
|
+
const day = Number(dateText[2]);
|
|
469
|
+
retVal = new Date(year, month, day, 0, retVal.getTimezoneOffset() * -1);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
retVal = new Date(retVal.getFullYear(), retVal.getMonth(), retVal.getDate(), retVal.getHours(), retVal.getMinutes() + retVal.getTimezoneOffset() * -1, retVal.getSeconds());
|
|
454
474
|
}
|
|
455
475
|
}
|
|
456
|
-
|
|
476
|
+
if (retVal && isNaN(retVal.getTime())) {
|
|
477
|
+
retVal = null;
|
|
478
|
+
}
|
|
479
|
+
return retVal;
|
|
457
480
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
PepDateFormatterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepDateFormatterPipe, name: "pepDateFormatter" });
|
|
461
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepDateFormatterPipe, decorators: [{
|
|
462
|
-
type: Pipe,
|
|
463
|
-
args: [{ name: 'pepDateFormatter' }]
|
|
464
|
-
}] });
|
|
465
|
-
class PepDateStringFormatterPipe {
|
|
466
|
-
transform(value, culture, showTime = false) {
|
|
467
|
-
let res = '';
|
|
468
|
-
const tmpDate = new Date(value);
|
|
469
|
-
if (value) {
|
|
470
|
-
res = tmpDate.toLocaleDateString(culture || 'en-US');
|
|
481
|
+
stringifyDate(date, showTime = false) {
|
|
482
|
+
if (date) {
|
|
471
483
|
if (showTime) {
|
|
472
|
-
|
|
484
|
+
return date.toISOString(); // include - offset
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
const dateText = [];
|
|
488
|
+
dateText.push(date.getFullYear(), '-', date.getMonth() + 1, '-', date.getDate());
|
|
489
|
+
return dateText.join('');
|
|
473
490
|
}
|
|
474
491
|
}
|
|
475
|
-
|
|
492
|
+
else {
|
|
493
|
+
return '';
|
|
494
|
+
}
|
|
476
495
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
args: [{ name: 'pepDateStringFormatter' }]
|
|
483
|
-
}] });
|
|
484
|
-
class PepSafeHtmlPipe {
|
|
485
|
-
constructor(sanitizer) {
|
|
486
|
-
this.sanitizer = sanitizer;
|
|
496
|
+
isValueHtml(value) {
|
|
497
|
+
let res = false;
|
|
498
|
+
const REGEXP = /<\/?[a-z][\s\S]*>/i;
|
|
499
|
+
res = REGEXP.test(value);
|
|
500
|
+
return res;
|
|
487
501
|
}
|
|
488
|
-
|
|
489
|
-
|
|
502
|
+
isJsonString(str) {
|
|
503
|
+
try {
|
|
504
|
+
JSON.parse(str);
|
|
505
|
+
}
|
|
506
|
+
catch (e) {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
return true;
|
|
490
510
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
this.sanitizer = sanitizer;
|
|
511
|
+
getSvgElementFromString(document, svgContent) {
|
|
512
|
+
const div = document.createElement('DIV');
|
|
513
|
+
// div.className = 'svg-icon';
|
|
514
|
+
// Add class svg-icon
|
|
515
|
+
if (svgContent?.length > 0) {
|
|
516
|
+
div.innerHTML = svgContent.replace('<svg ', '<svg class="svg-icon" ');
|
|
517
|
+
}
|
|
518
|
+
return (div.querySelector('svg') ||
|
|
519
|
+
document.createElementNS('http://www.w3.org/2000/svg', 'path'));
|
|
501
520
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
521
|
+
// formatPercent(value: any, digitsInfo = '1.0-2') {
|
|
522
|
+
formatPercent(value, minFractionDigits = 0, maxFractionDigits = 2) {
|
|
523
|
+
minFractionDigits = coerceNumberProperty(minFractionDigits, null);
|
|
524
|
+
maxFractionDigits = coerceNumberProperty(maxFractionDigits, null);
|
|
525
|
+
value = this.cutValueByFractionDigits(value?.toString(), Math.max(minFractionDigits, maxFractionDigits));
|
|
526
|
+
const number = this.prepareNumberToFormat(value);
|
|
527
|
+
if (number === 0) {
|
|
528
|
+
return '0%';
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
// return formatPercent(number / 100, this.culture, digitsInfo);
|
|
532
|
+
return new Intl.NumberFormat(this.culture, {
|
|
533
|
+
style: 'percent',
|
|
534
|
+
minimumFractionDigits: minFractionDigits || 0,
|
|
535
|
+
maximumFractionDigits: maxFractionDigits || Math.max(2, minFractionDigits),
|
|
536
|
+
}).format(number / 100);
|
|
516
537
|
}
|
|
517
538
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
return parseInt(value);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
PepToNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepToNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
543
|
-
PepToNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepToNumberPipe, name: "pepToNumber" });
|
|
544
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepToNumberPipe, decorators: [{
|
|
545
|
-
type: Pipe,
|
|
546
|
-
args: [{ name: 'pepToNumber' }]
|
|
547
|
-
}] });
|
|
548
|
-
|
|
549
|
-
class DateAgoPipe {
|
|
550
|
-
constructor(translateService) {
|
|
551
|
-
this.translateService = translateService;
|
|
552
|
-
}
|
|
553
|
-
getCounterTranslation(counter, key) {
|
|
554
|
-
const intervalText = this.translateService.get(`DATE_AGO.${key.toUpperCase()}`) || key;
|
|
555
|
-
const agoText = this.translateService.get(counter === 1 ? 'DATE_AGO.SINGULAR' : 'DATE_AGO.PLURAL') || counter === 1 ? ' ago' : 's ago';
|
|
556
|
-
return `${intervalText}${agoText}`;
|
|
557
|
-
}
|
|
558
|
-
transform(value, args) {
|
|
559
|
-
if (value) {
|
|
560
|
-
const seconds = Math.floor((+new Date() - +new Date(value)) / 1000);
|
|
561
|
-
if (seconds < 29) // less than 30 seconds ago will show as 'Just now'
|
|
562
|
-
return this.translateService.get('DATE_AGO.JUST_NOW') || 'Just now';
|
|
563
|
-
const intervals = {
|
|
564
|
-
'year': 31536000,
|
|
565
|
-
'month': 2592000,
|
|
566
|
-
'week': 604800,
|
|
567
|
-
'day': 86400,
|
|
568
|
-
'hour': 3600,
|
|
569
|
-
'minute': 60,
|
|
570
|
-
'second': 1
|
|
571
|
-
};
|
|
572
|
-
let counter;
|
|
573
|
-
for (const i in intervals) {
|
|
574
|
-
counter = Math.floor(seconds / intervals[i]);
|
|
575
|
-
if (counter > 0) {
|
|
576
|
-
this.getCounterTranslation(counter, i);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
539
|
+
// formatCurrency(value: any, currencySign = '', digitsInfo = '1.2-2') {
|
|
540
|
+
formatCurrency(value, currencySign = '', minFractionDigits = 2, maxFractionDigits = 2, useGrouping = true) {
|
|
541
|
+
minFractionDigits = coerceNumberProperty(minFractionDigits, null);
|
|
542
|
+
maxFractionDigits = coerceNumberProperty(maxFractionDigits, null);
|
|
543
|
+
let res = '';
|
|
544
|
+
// If the decimal separator is the last digit
|
|
545
|
+
// if (value.length > 0 && value.indexOf(this.getDecimalSeparator()) === value.length -1) {
|
|
546
|
+
// res = value;
|
|
547
|
+
// } else {
|
|
548
|
+
value = this.cutValueByFractionDigits(value?.toString(), Math.max(minFractionDigits, maxFractionDigits));
|
|
549
|
+
const number = this.prepareNumberToFormat(value);
|
|
550
|
+
const styleOptions = {
|
|
551
|
+
// style: 'currency',
|
|
552
|
+
// currencySign: currencySign,
|
|
553
|
+
useGrouping: useGrouping,
|
|
554
|
+
minimumFractionDigits: minFractionDigits || Math.min(2, maxFractionDigits || 2),
|
|
555
|
+
maximumFractionDigits: maxFractionDigits || Math.max(2, minFractionDigits),
|
|
556
|
+
};
|
|
557
|
+
if (number === 0) {
|
|
558
|
+
// return formatCurrency(0, this.culture, currencySign, undefined, digitsInfo);
|
|
559
|
+
res = new Intl.NumberFormat(this.culture, styleOptions).format(0);
|
|
579
560
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}]
|
|
590
|
-
}], ctorParameters: function () { return [{ type: i1.TranslateService }]; } });
|
|
591
|
-
|
|
592
|
-
class PepInputAutoWidthDirective {
|
|
593
|
-
constructor(renderer, el) {
|
|
594
|
-
this.renderer = renderer;
|
|
595
|
-
this.el = el;
|
|
596
|
-
this.includePadding = true;
|
|
597
|
-
this.input = null;
|
|
561
|
+
else {
|
|
562
|
+
// return formatCurrency(value, this.culture, currencySign, undefined, digitsInfo);
|
|
563
|
+
res = new Intl.NumberFormat(this.culture, styleOptions).format(number);
|
|
564
|
+
}
|
|
565
|
+
if (currencySign.length > 0) {
|
|
566
|
+
res = this.isCurrencyShouldBeOnRight(currencySign) ? `${res} ${currencySign}` : `${currencySign} ${res}`;
|
|
567
|
+
}
|
|
568
|
+
// }
|
|
569
|
+
return res;
|
|
598
570
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
571
|
+
// formatDecimal(value: any, digitsInfo = '1.2-2') {
|
|
572
|
+
formatDecimal(value, minFractionDigits = 2, maxFractionDigits = 2, useGrouping = true) {
|
|
573
|
+
minFractionDigits = coerceNumberProperty(minFractionDigits, null);
|
|
574
|
+
// console.log('formatDecimal minFractionDigits value is', minFractionDigits);
|
|
575
|
+
maxFractionDigits = coerceNumberProperty(maxFractionDigits, null);
|
|
576
|
+
// console.log('formatDecimal minFractionDigits value is', maxFractionDigits);
|
|
577
|
+
value = this.cutValueByFractionDigits(value?.toString(), Math.max(minFractionDigits, maxFractionDigits));
|
|
578
|
+
const number = this.prepareNumberToFormat(value);
|
|
579
|
+
// console.log('number value is', number);
|
|
580
|
+
if (number === 0) {
|
|
581
|
+
return '0';
|
|
602
582
|
}
|
|
603
583
|
else {
|
|
604
|
-
|
|
605
|
-
|
|
584
|
+
// return formatNumber(value, this.culture, digitsInfo);
|
|
585
|
+
const res = new Intl.NumberFormat(this.culture, {
|
|
586
|
+
useGrouping: useGrouping,
|
|
587
|
+
minimumFractionDigits: minFractionDigits || Math.min(2, maxFractionDigits || 2),
|
|
588
|
+
maximumFractionDigits: maxFractionDigits || Math.max(2, minFractionDigits),
|
|
589
|
+
}).format(number);
|
|
590
|
+
// console.log('Intl.NumberFormat value is', res);
|
|
591
|
+
return res;
|
|
606
592
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
593
|
+
}
|
|
594
|
+
// formatNumber(value: any, digitsInfo = '1.0-0'): string {
|
|
595
|
+
formatNumber(value, useGrouping = true) {
|
|
596
|
+
const number = this.prepareNumberToFormat(value);
|
|
597
|
+
if (number === 0) {
|
|
598
|
+
return '0';
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
// return formatNumber(value, this.culture, digitsInfo);
|
|
602
|
+
return new Intl.NumberFormat(this.culture, {
|
|
603
|
+
useGrouping: useGrouping,
|
|
604
|
+
minimumFractionDigits: 0,
|
|
605
|
+
maximumFractionDigits: 0,
|
|
606
|
+
}).format(number);
|
|
610
607
|
}
|
|
611
|
-
this.setWidthUsingText();
|
|
612
608
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
609
|
+
/**
|
|
610
|
+
* Convert a number in milliseconds to a standard duration string.
|
|
611
|
+
* @param {number} value - duration in milliseconds
|
|
612
|
+
* @param {object} options - formatDuration options object
|
|
613
|
+
* @param {boolean} [options.leading=false] - add leading zero
|
|
614
|
+
* @returns string - formatted duration string
|
|
615
|
+
*/
|
|
616
|
+
formatDuration(value, options = {}) {
|
|
617
|
+
const isNumber = _isNumberValue(value);
|
|
618
|
+
if (!isNumber) {
|
|
619
|
+
return value;
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
let number = this.prepareNumberToFormat(value);
|
|
623
|
+
const leading = options?.leading || true;
|
|
624
|
+
const duration = options?.duration || 'milliseconds';
|
|
625
|
+
if (duration === 'seconds') {
|
|
626
|
+
number = number * 1000;
|
|
627
|
+
}
|
|
628
|
+
const unsignedMs = number < 0 ? -number : number;
|
|
629
|
+
const sign = number <= -1000 ? '-' : '';
|
|
630
|
+
const t = this.parseMs(unsignedMs);
|
|
631
|
+
const seconds = this.addZero(t.seconds);
|
|
632
|
+
if (t.days) {
|
|
633
|
+
return sign + t.days + ':' + this.addZero(t.hours) + ':' + this.addZero(t.minutes) + ':' + seconds;
|
|
634
|
+
}
|
|
635
|
+
if (t.hours) {
|
|
636
|
+
return sign + (leading ? this.addZero(t.hours) : t.hours) + ':' + this.addZero(t.minutes) + ':' + seconds;
|
|
637
|
+
}
|
|
638
|
+
return sign + (leading ? this.addZero(t.minutes) : t.minutes) + ':' + seconds;
|
|
639
|
+
}
|
|
616
640
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
: 0;
|
|
641
|
+
incrementNumber(value) {
|
|
642
|
+
let numberValue = coerceNumberProperty(value, 0);
|
|
643
|
+
return (++numberValue).toString();
|
|
621
644
|
}
|
|
622
|
-
|
|
623
|
-
|
|
645
|
+
decrementNumber(value) {
|
|
646
|
+
let numberValue = coerceNumberProperty(value, 0);
|
|
647
|
+
return (--numberValue).toString();
|
|
624
648
|
}
|
|
625
|
-
|
|
626
|
-
|
|
649
|
+
getDecimalSeparator() {
|
|
650
|
+
const numberWithDecimalSeparator = 1.1;
|
|
651
|
+
return numberWithDecimalSeparator
|
|
652
|
+
.toLocaleString(this.culture)
|
|
653
|
+
.substring(1, 2);
|
|
627
654
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
655
|
+
changeDecimalSeparatorWhenItsComma(value, reverse = false) {
|
|
656
|
+
// If the decimal separator is ','
|
|
657
|
+
if (this.getDecimalSeparator() === ',') {
|
|
658
|
+
// In case that the value isn't string.
|
|
659
|
+
value = value?.toString() || '';
|
|
660
|
+
// If reverse change the number from '.' to ',' else do the opposite.
|
|
661
|
+
value = reverse ? value.replace('.', ',') : value.replace(',', '.');
|
|
632
662
|
}
|
|
663
|
+
return value;
|
|
633
664
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
textWidth(value) {
|
|
640
|
-
const ctx = this.renderer.createElement('canvas').getContext('2d');
|
|
641
|
-
const { fontStyle, fontVariant, fontWeight, fontSize, fontFamily, } = this.style;
|
|
642
|
-
// font string format: {normal, normal, 700, 20px, Roboto, "Helvetica Neue", sans-serif}
|
|
643
|
-
ctx.font =
|
|
644
|
-
fontStyle +
|
|
645
|
-
' ' +
|
|
646
|
-
fontVariant +
|
|
647
|
-
' ' +
|
|
648
|
-
fontWeight +
|
|
649
|
-
' ' +
|
|
650
|
-
fontSize +
|
|
651
|
-
' ' +
|
|
652
|
-
fontFamily;
|
|
653
|
-
return ctx ? ctx.measureText(value).width : 0;
|
|
665
|
+
isEqualNumber(numberAsString, numberAsString2) {
|
|
666
|
+
const number = this.prepareNumberToFormat(numberAsString);
|
|
667
|
+
const number2 = this.prepareNumberToFormat(numberAsString2);
|
|
668
|
+
return number === number2;
|
|
654
669
|
}
|
|
655
670
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type:
|
|
659
|
-
type:
|
|
671
|
+
PepUtilitiesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepUtilitiesService, deps: [{ token: i1.TranslateService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
672
|
+
PepUtilitiesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepUtilitiesService, providedIn: 'root' });
|
|
673
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepUtilitiesService, decorators: [{
|
|
674
|
+
type: Injectable,
|
|
660
675
|
args: [{
|
|
661
|
-
|
|
676
|
+
providedIn: 'root',
|
|
662
677
|
}]
|
|
663
|
-
}], ctorParameters: function () { return [{ type:
|
|
664
|
-
|
|
665
|
-
|
|
678
|
+
}], ctorParameters: function () { return [{ type: i1.TranslateService, decorators: [{
|
|
679
|
+
type: Optional
|
|
680
|
+
}] }]; } });
|
|
666
681
|
|
|
667
|
-
class
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
this.element.nativeElement.blur();
|
|
674
|
-
}, 0);
|
|
682
|
+
class PepCapitalizePipe {
|
|
683
|
+
transform(value) {
|
|
684
|
+
if (value) {
|
|
685
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
686
|
+
}
|
|
687
|
+
return value;
|
|
675
688
|
}
|
|
676
689
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type:
|
|
680
|
-
type:
|
|
681
|
-
args: [{
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
class PepUtilitiesService {
|
|
690
|
-
constructor(translate = null) {
|
|
691
|
-
this.translate = translate;
|
|
692
|
-
this.culture = 'en-US';
|
|
693
|
-
this.culture = this.translate?.getBrowserCultureLang() || 'en-US';
|
|
694
|
-
// try {
|
|
695
|
-
// import(`@angular/common/locales/global/${this.culture}`);
|
|
696
|
-
// } catch {}
|
|
697
|
-
}
|
|
698
|
-
prepareNumberToFormat(value, fallbackValue = 0) {
|
|
699
|
-
// If the decimal separator is ',' change it to '.'
|
|
700
|
-
if (value?.length > 0) {
|
|
701
|
-
// If the decimal separator is ',' change it to '.' for let the formatting works.
|
|
702
|
-
value = this.changeDecimalSeparatorWhenItsComma(value);
|
|
703
|
-
// console.log('coerceNumberProperty after change decimal separator value is', value);
|
|
690
|
+
PepCapitalizePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepCapitalizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
691
|
+
PepCapitalizePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepCapitalizePipe, name: "pepCapitalize" });
|
|
692
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepCapitalizePipe, decorators: [{
|
|
693
|
+
type: Pipe,
|
|
694
|
+
args: [{ name: 'pepCapitalize' }]
|
|
695
|
+
}] });
|
|
696
|
+
class PepEncodePipe {
|
|
697
|
+
transform(value) {
|
|
698
|
+
if (value) {
|
|
699
|
+
const v = btoa(value);
|
|
700
|
+
return v;
|
|
704
701
|
}
|
|
705
|
-
return
|
|
702
|
+
return value;
|
|
706
703
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
704
|
+
}
|
|
705
|
+
PepEncodePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepEncodePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
706
|
+
PepEncodePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepEncodePipe, name: "pepEncode" });
|
|
707
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepEncodePipe, decorators: [{
|
|
708
|
+
type: Pipe,
|
|
709
|
+
args: [{ name: 'pepEncode' }]
|
|
710
|
+
}] });
|
|
711
|
+
class PepEscapePipe {
|
|
712
|
+
transform(value) {
|
|
713
|
+
if (value) {
|
|
714
|
+
const v = escape(value);
|
|
715
|
+
return v;
|
|
712
716
|
}
|
|
713
|
-
return
|
|
714
|
-
days: Math.trunc(milliseconds / 86400000),
|
|
715
|
-
hours: Math.trunc(milliseconds / 3600000) % 24,
|
|
716
|
-
minutes: Math.trunc(milliseconds / 60000) % 60,
|
|
717
|
-
seconds: Math.trunc(milliseconds / 1000) % 60,
|
|
718
|
-
milliseconds: Math.trunc(milliseconds) % 1000
|
|
719
|
-
};
|
|
717
|
+
return value;
|
|
720
718
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
719
|
+
}
|
|
720
|
+
PepEscapePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepEscapePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
721
|
+
PepEscapePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepEscapePipe, name: "pepEscape" });
|
|
722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepEscapePipe, decorators: [{
|
|
723
|
+
type: Pipe,
|
|
724
|
+
args: [{ name: 'pepEscape' }]
|
|
725
|
+
}] });
|
|
726
|
+
class PepReplaceLineBreaksPipe {
|
|
727
|
+
transform(value) {
|
|
728
|
+
const newValue = value.replace(/(<br\ ?\/?>)/g, ' ');
|
|
729
|
+
return newValue;
|
|
731
730
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
731
|
+
}
|
|
732
|
+
PepReplaceLineBreaksPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepReplaceLineBreaksPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
733
|
+
PepReplaceLineBreaksPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepReplaceLineBreaksPipe, name: "pepReplaceLineBreaks" });
|
|
734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepReplaceLineBreaksPipe, decorators: [{
|
|
735
|
+
type: Pipe,
|
|
736
|
+
args: [{ name: 'pepReplaceLineBreaks' }]
|
|
737
|
+
}] });
|
|
738
|
+
class PepDateFormatterPipe {
|
|
739
|
+
transform(value, culture, showTime = false) {
|
|
740
|
+
let res = '';
|
|
741
|
+
value = new Date(value);
|
|
742
|
+
if (value) {
|
|
743
|
+
res = value.toLocaleDateString(culture || 'en-US');
|
|
744
|
+
if (showTime) {
|
|
745
|
+
res +=
|
|
746
|
+
' ' +
|
|
747
|
+
value.toLocaleTimeString(culture || 'en-US', {
|
|
748
|
+
hour: '2-digit',
|
|
749
|
+
minute: '2-digit',
|
|
750
|
+
});
|
|
751
|
+
}
|
|
742
752
|
}
|
|
743
753
|
return res;
|
|
744
754
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
+
}
|
|
756
|
+
PepDateFormatterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepDateFormatterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
757
|
+
PepDateFormatterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepDateFormatterPipe, name: "pepDateFormatter" });
|
|
758
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepDateFormatterPipe, decorators: [{
|
|
759
|
+
type: Pipe,
|
|
760
|
+
args: [{ name: 'pepDateFormatter' }]
|
|
761
|
+
}] });
|
|
762
|
+
class PepDateStringFormatterPipe {
|
|
763
|
+
transform(value, culture, showTime = false) {
|
|
764
|
+
let res = '';
|
|
765
|
+
const tmpDate = new Date(value);
|
|
766
|
+
if (value) {
|
|
767
|
+
res = tmpDate.toLocaleDateString(culture || 'en-US');
|
|
768
|
+
if (showTime) {
|
|
769
|
+
res += ' ' + tmpDate.toLocaleTimeString(culture || 'en-US');
|
|
770
|
+
}
|
|
755
771
|
}
|
|
756
772
|
return res;
|
|
757
773
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
const dateText = dateStr.split('-');
|
|
769
|
-
if (dateText.length === 3) {
|
|
770
|
-
const year = Number(dateText[0]);
|
|
771
|
-
const month = Number(dateText[1]) - 1;
|
|
772
|
-
const day = Number(dateText[2]);
|
|
773
|
-
retVal = new Date(year, month, day, 0, retVal.getTimezoneOffset() * -1);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
else {
|
|
777
|
-
retVal = new Date(retVal.getFullYear(), retVal.getMonth(), retVal.getDate(), retVal.getHours(), retVal.getMinutes() + retVal.getTimezoneOffset() * -1, retVal.getSeconds());
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
if (retVal && isNaN(retVal.getTime())) {
|
|
781
|
-
retVal = null;
|
|
782
|
-
}
|
|
783
|
-
return retVal;
|
|
774
|
+
}
|
|
775
|
+
PepDateStringFormatterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepDateStringFormatterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
776
|
+
PepDateStringFormatterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepDateStringFormatterPipe, name: "pepDateStringFormatter" });
|
|
777
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepDateStringFormatterPipe, decorators: [{
|
|
778
|
+
type: Pipe,
|
|
779
|
+
args: [{ name: 'pepDateStringFormatter' }]
|
|
780
|
+
}] });
|
|
781
|
+
class PepSafeHtmlPipe {
|
|
782
|
+
constructor(sanitizer) {
|
|
783
|
+
this.sanitizer = sanitizer;
|
|
784
784
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
if (showTime) {
|
|
788
|
-
return date.toISOString(); // include - offset
|
|
789
|
-
}
|
|
790
|
-
else {
|
|
791
|
-
const dateText = [];
|
|
792
|
-
dateText.push(date.getFullYear(), '-', date.getMonth() + 1, '-', date.getDate());
|
|
793
|
-
return dateText.join('');
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
else {
|
|
797
|
-
return '';
|
|
798
|
-
}
|
|
785
|
+
transform(html) {
|
|
786
|
+
return this.sanitizer.bypassSecurityTrustHtml(html);
|
|
799
787
|
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
788
|
+
}
|
|
789
|
+
PepSafeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSafeHtmlPipe, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
790
|
+
PepSafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepSafeHtmlPipe, name: "pepSafeHtml" });
|
|
791
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSafeHtmlPipe, decorators: [{
|
|
792
|
+
type: Pipe,
|
|
793
|
+
args: [{ name: 'pepSafeHtml' }]
|
|
794
|
+
}], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; } });
|
|
795
|
+
class PepSafePipe {
|
|
796
|
+
constructor(sanitizer) {
|
|
797
|
+
this.sanitizer = sanitizer;
|
|
805
798
|
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
799
|
+
transform(value, type) {
|
|
800
|
+
switch (type) {
|
|
801
|
+
case 'html':
|
|
802
|
+
return this.sanitizer.bypassSecurityTrustHtml(value);
|
|
803
|
+
case 'style':
|
|
804
|
+
return this.sanitizer.bypassSecurityTrustStyle(value);
|
|
805
|
+
case 'script':
|
|
806
|
+
return this.sanitizer.bypassSecurityTrustScript(value);
|
|
807
|
+
case 'url':
|
|
808
|
+
return this.sanitizer.bypassSecurityTrustUrl(value);
|
|
809
|
+
case 'resourceUrl':
|
|
810
|
+
return this.sanitizer.bypassSecurityTrustResourceUrl(value);
|
|
811
|
+
default:
|
|
812
|
+
throw new Error(`Invalid safe type specified: ${type}`);
|
|
812
813
|
}
|
|
813
|
-
return true;
|
|
814
814
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
|
|
815
|
+
}
|
|
816
|
+
PepSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSafePipe, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
817
|
+
PepSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepSafePipe, name: "pepSafe" });
|
|
818
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSafePipe, decorators: [{
|
|
819
|
+
type: Pipe,
|
|
820
|
+
args: [{ name: 'pepSafe' }]
|
|
821
|
+
}], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; } });
|
|
822
|
+
class PepSplitUppercasePipe {
|
|
823
|
+
transform(value) {
|
|
824
|
+
const newValue = value.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
825
|
+
return newValue;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
PepSplitUppercasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSplitUppercasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
829
|
+
PepSplitUppercasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepSplitUppercasePipe, name: "pepSplitUppercase" });
|
|
830
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSplitUppercasePipe, decorators: [{
|
|
831
|
+
type: Pipe,
|
|
832
|
+
args: [{ name: 'pepSplitUppercase' }]
|
|
833
|
+
}] });
|
|
834
|
+
class PepToNumberPipe {
|
|
835
|
+
constructor(utilitiesService) {
|
|
836
|
+
this.utilitiesService = utilitiesService;
|
|
837
|
+
}
|
|
838
|
+
transform(value) {
|
|
839
|
+
const decimalSeparator = this.utilitiesService.getDecimalSeparator();
|
|
840
|
+
// We need to remove the thousands separator so - If the decimal separator is '.' we need to remove the ',' from the value else we remove the '.'.
|
|
841
|
+
value = decimalSeparator === '.' ? value.replace(/,/g, '') : value.replace(/./g, '');
|
|
842
|
+
const numberValue = coerceNumberProperty(value);
|
|
843
|
+
return numberValue;
|
|
844
|
+
// return parseInt(value);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
PepToNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepToNumberPipe, deps: [{ token: PepUtilitiesService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
848
|
+
PepToNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepToNumberPipe, name: "pepToNumber" });
|
|
849
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepToNumberPipe, decorators: [{
|
|
850
|
+
type: Pipe,
|
|
851
|
+
args: [{ name: 'pepToNumber' }]
|
|
852
|
+
}], ctorParameters: function () { return [{ type: PepUtilitiesService }]; } });
|
|
853
|
+
|
|
854
|
+
class DateAgoPipe {
|
|
855
|
+
constructor(translateService) {
|
|
856
|
+
this.translateService = translateService;
|
|
857
|
+
}
|
|
858
|
+
getCounterTranslation(counter, key) {
|
|
859
|
+
const intervalText = this.translateService.get(`DATE_AGO.${key.toUpperCase()}`) || key;
|
|
860
|
+
const agoText = this.translateService.get(counter === 1 ? 'DATE_AGO.SINGULAR' : 'DATE_AGO.PLURAL') || counter === 1 ? ' ago' : 's ago';
|
|
861
|
+
return `${intervalText}${agoText}`;
|
|
824
862
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
863
|
+
transform(value, args) {
|
|
864
|
+
if (value) {
|
|
865
|
+
const seconds = Math.floor((+new Date() - +new Date(value)) / 1000);
|
|
866
|
+
if (seconds < 29) // less than 30 seconds ago will show as 'Just now'
|
|
867
|
+
return this.translateService.get('DATE_AGO.JUST_NOW') || 'Just now';
|
|
868
|
+
const intervals = {
|
|
869
|
+
'year': 31536000,
|
|
870
|
+
'month': 2592000,
|
|
871
|
+
'week': 604800,
|
|
872
|
+
'day': 86400,
|
|
873
|
+
'hour': 3600,
|
|
874
|
+
'minute': 60,
|
|
875
|
+
'second': 1
|
|
876
|
+
};
|
|
877
|
+
let counter;
|
|
878
|
+
for (const i in intervals) {
|
|
879
|
+
counter = Math.floor(seconds / intervals[i]);
|
|
880
|
+
if (counter > 0) {
|
|
881
|
+
this.getCounterTranslation(counter, i);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
841
884
|
}
|
|
885
|
+
return value;
|
|
842
886
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
maximumFractionDigits: maxFractionDigits || Math.max(2, minFractionDigits),
|
|
860
|
-
};
|
|
861
|
-
if (number === 0) {
|
|
862
|
-
// return formatCurrency(0, this.culture, currencySign, undefined, digitsInfo);
|
|
863
|
-
res = new Intl.NumberFormat(this.culture, styleOptions).format(0);
|
|
864
|
-
}
|
|
865
|
-
else {
|
|
866
|
-
// return formatCurrency(value, this.culture, currencySign, undefined, digitsInfo);
|
|
867
|
-
res = new Intl.NumberFormat(this.culture, styleOptions).format(number);
|
|
868
|
-
}
|
|
869
|
-
if (currencySign.length > 0) {
|
|
870
|
-
res = this.isCurrencyShouldBeOnRight(currencySign) ? `${res} ${currencySign}` : `${currencySign} ${res}`;
|
|
871
|
-
}
|
|
872
|
-
// }
|
|
873
|
-
return res;
|
|
887
|
+
}
|
|
888
|
+
DateAgoPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DateAgoPipe, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
889
|
+
DateAgoPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: DateAgoPipe, name: "dateAgo" });
|
|
890
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DateAgoPipe, decorators: [{
|
|
891
|
+
type: Pipe,
|
|
892
|
+
args: [{
|
|
893
|
+
name: 'dateAgo'
|
|
894
|
+
}]
|
|
895
|
+
}], ctorParameters: function () { return [{ type: i1.TranslateService }]; } });
|
|
896
|
+
|
|
897
|
+
class PepInputAutoWidthDirective {
|
|
898
|
+
constructor(renderer, el) {
|
|
899
|
+
this.renderer = renderer;
|
|
900
|
+
this.el = el;
|
|
901
|
+
this.includePadding = true;
|
|
902
|
+
this.input = null;
|
|
874
903
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
// console.log('formatDecimal minFractionDigits value is', minFractionDigits);
|
|
879
|
-
maxFractionDigits = coerceNumberProperty(maxFractionDigits, null);
|
|
880
|
-
// console.log('formatDecimal minFractionDigits value is', maxFractionDigits);
|
|
881
|
-
value = this.cutValueByFractionDigits(value?.toString(), Math.max(minFractionDigits, maxFractionDigits));
|
|
882
|
-
const number = this.prepareNumberToFormat(value);
|
|
883
|
-
// console.log('number value is', number);
|
|
884
|
-
if (number === 0) {
|
|
885
|
-
return '0';
|
|
904
|
+
ngAfterViewInit() {
|
|
905
|
+
if (this.el.nativeElement.tagName.toLowerCase() === 'input') {
|
|
906
|
+
this.input = this.el;
|
|
886
907
|
}
|
|
887
908
|
else {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
useGrouping: useGrouping,
|
|
891
|
-
minimumFractionDigits: minFractionDigits || Math.min(2, maxFractionDigits || 2),
|
|
892
|
-
maximumFractionDigits: maxFractionDigits || Math.max(2, minFractionDigits),
|
|
893
|
-
}).format(number);
|
|
894
|
-
// console.log('Intl.NumberFormat value is', res);
|
|
895
|
-
return res;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
// formatNumber(value: any, digitsInfo = '1.0-0'): string {
|
|
899
|
-
formatNumber(value, useGrouping = true) {
|
|
900
|
-
const number = this.prepareNumberToFormat(value);
|
|
901
|
-
if (number === 0) {
|
|
902
|
-
return '0';
|
|
909
|
+
const list = this.el.nativeElement.querySelectorAll('input');
|
|
910
|
+
this.input = list.length > 0 ? list[0] : null;
|
|
903
911
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
useGrouping: useGrouping,
|
|
908
|
-
minimumFractionDigits: 0,
|
|
909
|
-
maximumFractionDigits: 0,
|
|
910
|
-
}).format(number);
|
|
912
|
+
if (this.input) {
|
|
913
|
+
this.input.addEventListener('blur', this.setWidthUsingText.bind(this));
|
|
914
|
+
this.input.addEventListener('keyup', this.setWidthUsingText.bind(this));
|
|
911
915
|
}
|
|
916
|
+
this.setWidthUsingText();
|
|
912
917
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
* @param {object} options - formatDuration options object
|
|
917
|
-
* @param {boolean} [options.leading=false] - add leading zero
|
|
918
|
-
* @returns string - formatted duration string
|
|
919
|
-
*/
|
|
920
|
-
formatDuration(value, options = {}) {
|
|
921
|
-
const isNumber = _isNumberValue(value);
|
|
922
|
-
if (!isNumber) {
|
|
923
|
-
return value;
|
|
924
|
-
}
|
|
925
|
-
else {
|
|
926
|
-
let number = this.prepareNumberToFormat(value);
|
|
927
|
-
const leading = options?.leading || true;
|
|
928
|
-
const duration = options?.duration || 'milliseconds';
|
|
929
|
-
if (duration === 'seconds') {
|
|
930
|
-
number = number * 1000;
|
|
931
|
-
}
|
|
932
|
-
const unsignedMs = number < 0 ? -number : number;
|
|
933
|
-
const sign = number <= -1000 ? '-' : '';
|
|
934
|
-
const t = this.parseMs(unsignedMs);
|
|
935
|
-
const seconds = this.addZero(t.seconds);
|
|
936
|
-
if (t.days) {
|
|
937
|
-
return sign + t.days + ':' + this.addZero(t.hours) + ':' + this.addZero(t.minutes) + ':' + seconds;
|
|
938
|
-
}
|
|
939
|
-
if (t.hours) {
|
|
940
|
-
return sign + (leading ? this.addZero(t.hours) : t.hours) + ':' + this.addZero(t.minutes) + ':' + seconds;
|
|
941
|
-
}
|
|
942
|
-
return sign + (leading ? this.addZero(t.minutes) : t.minutes) + ':' + seconds;
|
|
943
|
-
}
|
|
918
|
+
ngOnDestroy() {
|
|
919
|
+
this.input.removeEventListener('blur', this.setWidthUsingText.bind(this));
|
|
920
|
+
this.input.removeEventListener('keyup', this.setWidthUsingText.bind(this));
|
|
944
921
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
922
|
+
get paddingWidth() {
|
|
923
|
+
return this.includePadding
|
|
924
|
+
? this._sumPropertyValues(['padding-left', 'padding-right'])
|
|
925
|
+
: 0;
|
|
948
926
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
return (--numberValue).toString();
|
|
927
|
+
get style() {
|
|
928
|
+
return getComputedStyle(this.input, '');
|
|
952
929
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
return numberWithDecimalSeparator
|
|
956
|
-
.toLocaleString(this.culture)
|
|
957
|
-
.substring(1, 2);
|
|
930
|
+
setWidth(width) {
|
|
931
|
+
this.renderer.setStyle(this.input, 'width', width + 'px');
|
|
958
932
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
value = value?.toString() || '';
|
|
964
|
-
// If reverse change the number from '.' to ',' else do the opposite.
|
|
965
|
-
value = reverse ? value.replace('.', ',') : value.replace(',', '.');
|
|
933
|
+
setWidthUsingText() {
|
|
934
|
+
if (this.input) {
|
|
935
|
+
const text = this.input.value;
|
|
936
|
+
this.setWidth(this.textWidth(text) + this.paddingWidth);
|
|
966
937
|
}
|
|
967
|
-
return value;
|
|
968
938
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
939
|
+
_sumPropertyValues(properties) {
|
|
940
|
+
return properties
|
|
941
|
+
.map((property) => parseInt(this.style.getPropertyValue(property), 10))
|
|
942
|
+
.reduce((a, b) => a + b, 0);
|
|
943
|
+
}
|
|
944
|
+
textWidth(value) {
|
|
945
|
+
const ctx = this.renderer.createElement('canvas').getContext('2d');
|
|
946
|
+
const { fontStyle, fontVariant, fontWeight, fontSize, fontFamily, } = this.style;
|
|
947
|
+
// font string format: {normal, normal, 700, 20px, Roboto, "Helvetica Neue", sans-serif}
|
|
948
|
+
ctx.font =
|
|
949
|
+
fontStyle +
|
|
950
|
+
' ' +
|
|
951
|
+
fontVariant +
|
|
952
|
+
' ' +
|
|
953
|
+
fontWeight +
|
|
954
|
+
' ' +
|
|
955
|
+
fontSize +
|
|
956
|
+
' ' +
|
|
957
|
+
fontFamily;
|
|
958
|
+
return ctx ? ctx.measureText(value).width : 0;
|
|
973
959
|
}
|
|
974
960
|
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type:
|
|
978
|
-
type:
|
|
961
|
+
PepInputAutoWidthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepInputAutoWidthDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
962
|
+
PepInputAutoWidthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: PepInputAutoWidthDirective, selector: "[pepAutoWidth]", inputs: { includePadding: "includePadding" }, ngImport: i0 });
|
|
963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepInputAutoWidthDirective, decorators: [{
|
|
964
|
+
type: Directive,
|
|
979
965
|
args: [{
|
|
980
|
-
|
|
966
|
+
selector: '[pepAutoWidth]',
|
|
981
967
|
}]
|
|
982
|
-
}], ctorParameters: function () { return [{ type:
|
|
983
|
-
|
|
984
|
-
|
|
968
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { includePadding: [{
|
|
969
|
+
type: Input
|
|
970
|
+
}] } });
|
|
971
|
+
|
|
972
|
+
class PepButtonBlurDirective {
|
|
973
|
+
constructor(element) {
|
|
974
|
+
this.element = element;
|
|
975
|
+
}
|
|
976
|
+
onClick() {
|
|
977
|
+
setTimeout(() => {
|
|
978
|
+
this.element.nativeElement.blur();
|
|
979
|
+
}, 0);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
PepButtonBlurDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepButtonBlurDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
983
|
+
PepButtonBlurDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: PepButtonBlurDirective, selector: "[pepButtonBlur]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
984
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepButtonBlurDirective, decorators: [{
|
|
985
|
+
type: Directive,
|
|
986
|
+
args: [{
|
|
987
|
+
selector: '[pepButtonBlur]',
|
|
988
|
+
}]
|
|
989
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onClick: [{
|
|
990
|
+
type: HostListener,
|
|
991
|
+
args: ['click']
|
|
992
|
+
}] } });
|
|
985
993
|
|
|
986
994
|
class PepButtonLoaderDirective {
|
|
987
995
|
constructor(renderer, element, utilitiesService, document) {
|
|
@@ -1806,6 +1814,7 @@ class PepCustomizationService {
|
|
|
1806
1814
|
field.disabled ? formControl.disable() : formControl.enable();
|
|
1807
1815
|
const validators = field.getValidators();
|
|
1808
1816
|
formControl.setValidators(validators);
|
|
1817
|
+
formControl.updateValueAndValidity();
|
|
1809
1818
|
}
|
|
1810
1819
|
}
|
|
1811
1820
|
}
|
|
@@ -4318,6 +4327,12 @@ class PepFieldBase {
|
|
|
4318
4327
|
if (this.maxFieldCharacters > 0) {
|
|
4319
4328
|
validators.push(Validators.maxLength(this.maxFieldCharacters));
|
|
4320
4329
|
}
|
|
4330
|
+
if (this.minValue) {
|
|
4331
|
+
validators.push(Validators.min(this.minValue));
|
|
4332
|
+
}
|
|
4333
|
+
if (this.maxValue) {
|
|
4334
|
+
validators.push(Validators.max(this.maxValue));
|
|
4335
|
+
}
|
|
4321
4336
|
return validators;
|
|
4322
4337
|
}
|
|
4323
4338
|
getValidators() {
|