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