@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.
Files changed (185) hide show
  1. package/chips/chips.component.d.ts +1 -3
  2. package/core/common/pipes/common-pipes.d.ts +3 -0
  3. package/core/customization/customization.model.d.ts +1 -1
  4. package/esm2020/checkbox/checkbox.component.mjs +3 -3
  5. package/esm2020/chips/chips.component.mjs +8 -11
  6. package/esm2020/color/color.component.mjs +3 -3
  7. package/esm2020/core/common/pipes/common-pipes.mjs +14 -4
  8. package/esm2020/core/customization/customization.model.mjs +7 -1
  9. package/esm2020/core/customization/customization.service.mjs +2 -1
  10. package/esm2020/core/http/services/loader.service.mjs +3 -3
  11. package/esm2020/draggable-items/draggable-items.component.mjs +3 -3
  12. package/esm2020/form/field-generator.component.mjs +3 -3
  13. package/esm2020/form/form.component.mjs +3 -3
  14. package/esm2020/form/internal-carusel.component.mjs +10 -6
  15. package/esm2020/form/internal-field-generator.component.mjs +3 -3
  16. package/esm2020/form/internal-form.component.mjs +3 -3
  17. package/esm2020/form/internal-menu.component.mjs +4 -6
  18. package/esm2020/form/internal-page.component.mjs +3 -4
  19. package/esm2020/image/image.component.mjs +3 -3
  20. package/esm2020/images-filmstrip/images-filmstrip.component.mjs +3 -3
  21. package/esm2020/link/link.component.mjs +9 -3
  22. package/esm2020/list/list-actions.component.mjs +1 -1
  23. package/esm2020/list/list-chooser.component.mjs +1 -1
  24. package/esm2020/list/list-sorting.component.mjs +1 -1
  25. package/esm2020/list/list-views.component.mjs +1 -1
  26. package/esm2020/list/list.component.mjs +22 -10
  27. package/esm2020/list/list.model.mjs +1 -1
  28. package/esm2020/menu/menu-item.component.mjs +3 -3
  29. package/esm2020/menu/menu.component.mjs +6 -3
  30. package/esm2020/menu/menu.model.mjs +2 -1
  31. package/esm2020/profile-data-views-list/profile-data-view/profile-data-view.component.mjs +1 -1
  32. package/esm2020/profile-data-views-list/profile-data-views-card/profile-data-views-card.component.mjs +25 -9
  33. package/esm2020/profile-data-views-list/profile-data-views-list.component.mjs +58 -26
  34. package/esm2020/profile-data-views-list/profile-data-views-list.model.mjs +1 -1
  35. package/esm2020/quantity-selector/quantity-selector.component.mjs +7 -3
  36. package/esm2020/query-builder/common/model/legacy.mjs +1 -1
  37. package/esm2020/query-builder/common/model/operator.mjs +72 -62
  38. package/esm2020/query-builder/common/services/output-query.service.mjs +5 -3
  39. package/esm2020/query-builder/common/services/query-structure.service.mjs +24 -1
  40. package/esm2020/query-builder/query-builder-item/query-builder-item.component.mjs +3 -3
  41. package/esm2020/query-builder/query-builder-section/query-builder-section.component.mjs +3 -3
  42. package/esm2020/query-builder/query-builder.module.mjs +14 -3
  43. package/esm2020/query-builder/query-builder.service.mjs +2 -2
  44. package/esm2020/remote-loader/remote-loader.service.mjs +16 -16
  45. package/esm2020/rich-html-textarea/rich-html-textarea.component.mjs +10 -3
  46. package/esm2020/select/select.component.mjs +3 -3
  47. package/esm2020/select-panel/select-panel.component.mjs +3 -5
  48. package/esm2020/signature/signature-dialog.component.mjs +2 -1
  49. package/esm2020/signature/signature.component.mjs +4 -4
  50. package/esm2020/skeleton-loader/public-api.mjs +2 -2
  51. package/esm2020/skeleton-loader/skeleton-loader.component.mjs +3 -3
  52. package/esm2020/smart-filters/common/model/operator.mjs +11 -4
  53. package/esm2020/smart-filters/common/model/type.mjs +1 -1
  54. package/esm2020/smart-filters/multi-select-filter/multi-select-filter.component.mjs +3 -3
  55. package/esm2020/smart-filters/text-filter/text-filter.component.mjs +3 -3
  56. package/esm2020/textbox/textbox.component.mjs +26 -6
  57. package/fesm2015/pepperi-addons-ngx-lib-checkbox.mjs +2 -2
  58. package/fesm2015/pepperi-addons-ngx-lib-checkbox.mjs.map +1 -1
  59. package/fesm2015/pepperi-addons-ngx-lib-chips.mjs +7 -10
  60. package/fesm2015/pepperi-addons-ngx-lib-chips.mjs.map +1 -1
  61. package/fesm2015/pepperi-addons-ngx-lib-color.mjs +2 -2
  62. package/fesm2015/pepperi-addons-ngx-lib-color.mjs.map +1 -1
  63. package/fesm2015/pepperi-addons-ngx-lib-draggable-items.mjs +2 -2
  64. package/fesm2015/pepperi-addons-ngx-lib-draggable-items.mjs.map +1 -1
  65. package/fesm2015/pepperi-addons-ngx-lib-form.mjs +22 -21
  66. package/fesm2015/pepperi-addons-ngx-lib-form.mjs.map +1 -1
  67. package/fesm2015/pepperi-addons-ngx-lib-image.mjs +2 -2
  68. package/fesm2015/pepperi-addons-ngx-lib-image.mjs.map +1 -1
  69. package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.mjs +2 -2
  70. package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.mjs.map +1 -1
  71. package/fesm2015/pepperi-addons-ngx-lib-link.mjs +8 -2
  72. package/fesm2015/pepperi-addons-ngx-lib-link.mjs.map +1 -1
  73. package/fesm2015/pepperi-addons-ngx-lib-list.mjs +25 -13
  74. package/fesm2015/pepperi-addons-ngx-lib-list.mjs.map +1 -1
  75. package/fesm2015/pepperi-addons-ngx-lib-menu.mjs +8 -4
  76. package/fesm2015/pepperi-addons-ngx-lib-menu.mjs.map +1 -1
  77. package/fesm2015/pepperi-addons-ngx-lib-profile-data-views-list.mjs +81 -33
  78. package/fesm2015/pepperi-addons-ngx-lib-profile-data-views-list.mjs.map +1 -1
  79. package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.mjs +7 -2
  80. package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.mjs.map +1 -1
  81. package/fesm2015/pepperi-addons-ngx-lib-query-builder.mjs +119 -70
  82. package/fesm2015/pepperi-addons-ngx-lib-query-builder.mjs.map +1 -1
  83. package/fesm2015/pepperi-addons-ngx-lib-remote-loader.mjs +16 -16
  84. package/fesm2015/pepperi-addons-ngx-lib-remote-loader.mjs.map +1 -1
  85. package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.mjs +9 -2
  86. package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.mjs.map +1 -1
  87. package/fesm2015/pepperi-addons-ngx-lib-select-panel.mjs +2 -4
  88. package/fesm2015/pepperi-addons-ngx-lib-select-panel.mjs.map +1 -1
  89. package/fesm2015/pepperi-addons-ngx-lib-select.mjs +2 -2
  90. package/fesm2015/pepperi-addons-ngx-lib-select.mjs.map +1 -1
  91. package/fesm2015/pepperi-addons-ngx-lib-signature.mjs +5 -3
  92. package/fesm2015/pepperi-addons-ngx-lib-signature.mjs.map +1 -1
  93. package/fesm2015/pepperi-addons-ngx-lib-skeleton-loader.mjs +3 -3
  94. package/fesm2015/pepperi-addons-ngx-lib-skeleton-loader.mjs.map +1 -1
  95. package/fesm2015/pepperi-addons-ngx-lib-smart-filters.mjs +14 -7
  96. package/fesm2015/pepperi-addons-ngx-lib-smart-filters.mjs.map +1 -1
  97. package/fesm2015/pepperi-addons-ngx-lib-textbox.mjs +26 -5
  98. package/fesm2015/pepperi-addons-ngx-lib-textbox.mjs.map +1 -1
  99. package/fesm2015/pepperi-addons-ngx-lib.mjs +547 -532
  100. package/fesm2015/pepperi-addons-ngx-lib.mjs.map +1 -1
  101. package/fesm2020/pepperi-addons-ngx-lib-checkbox.mjs +2 -2
  102. package/fesm2020/pepperi-addons-ngx-lib-checkbox.mjs.map +1 -1
  103. package/fesm2020/pepperi-addons-ngx-lib-chips.mjs +7 -10
  104. package/fesm2020/pepperi-addons-ngx-lib-chips.mjs.map +1 -1
  105. package/fesm2020/pepperi-addons-ngx-lib-color.mjs +2 -2
  106. package/fesm2020/pepperi-addons-ngx-lib-color.mjs.map +1 -1
  107. package/fesm2020/pepperi-addons-ngx-lib-draggable-items.mjs +2 -2
  108. package/fesm2020/pepperi-addons-ngx-lib-draggable-items.mjs.map +1 -1
  109. package/fesm2020/pepperi-addons-ngx-lib-form.mjs +22 -21
  110. package/fesm2020/pepperi-addons-ngx-lib-form.mjs.map +1 -1
  111. package/fesm2020/pepperi-addons-ngx-lib-image.mjs +2 -2
  112. package/fesm2020/pepperi-addons-ngx-lib-image.mjs.map +1 -1
  113. package/fesm2020/pepperi-addons-ngx-lib-images-filmstrip.mjs +2 -2
  114. package/fesm2020/pepperi-addons-ngx-lib-images-filmstrip.mjs.map +1 -1
  115. package/fesm2020/pepperi-addons-ngx-lib-link.mjs +8 -2
  116. package/fesm2020/pepperi-addons-ngx-lib-link.mjs.map +1 -1
  117. package/fesm2020/pepperi-addons-ngx-lib-list.mjs +25 -13
  118. package/fesm2020/pepperi-addons-ngx-lib-list.mjs.map +1 -1
  119. package/fesm2020/pepperi-addons-ngx-lib-menu.mjs +8 -4
  120. package/fesm2020/pepperi-addons-ngx-lib-menu.mjs.map +1 -1
  121. package/fesm2020/pepperi-addons-ngx-lib-profile-data-views-list.mjs +81 -33
  122. package/fesm2020/pepperi-addons-ngx-lib-profile-data-views-list.mjs.map +1 -1
  123. package/fesm2020/pepperi-addons-ngx-lib-quantity-selector.mjs +6 -2
  124. package/fesm2020/pepperi-addons-ngx-lib-quantity-selector.mjs.map +1 -1
  125. package/fesm2020/pepperi-addons-ngx-lib-query-builder.mjs +115 -69
  126. package/fesm2020/pepperi-addons-ngx-lib-query-builder.mjs.map +1 -1
  127. package/fesm2020/pepperi-addons-ngx-lib-remote-loader.mjs +15 -15
  128. package/fesm2020/pepperi-addons-ngx-lib-remote-loader.mjs.map +1 -1
  129. package/fesm2020/pepperi-addons-ngx-lib-rich-html-textarea.mjs +9 -2
  130. package/fesm2020/pepperi-addons-ngx-lib-rich-html-textarea.mjs.map +1 -1
  131. package/fesm2020/pepperi-addons-ngx-lib-select-panel.mjs +2 -4
  132. package/fesm2020/pepperi-addons-ngx-lib-select-panel.mjs.map +1 -1
  133. package/fesm2020/pepperi-addons-ngx-lib-select.mjs +2 -2
  134. package/fesm2020/pepperi-addons-ngx-lib-select.mjs.map +1 -1
  135. package/fesm2020/pepperi-addons-ngx-lib-signature.mjs +4 -3
  136. package/fesm2020/pepperi-addons-ngx-lib-signature.mjs.map +1 -1
  137. package/fesm2020/pepperi-addons-ngx-lib-skeleton-loader.mjs +3 -3
  138. package/fesm2020/pepperi-addons-ngx-lib-skeleton-loader.mjs.map +1 -1
  139. package/fesm2020/pepperi-addons-ngx-lib-smart-filters.mjs +14 -7
  140. package/fesm2020/pepperi-addons-ngx-lib-smart-filters.mjs.map +1 -1
  141. package/fesm2020/pepperi-addons-ngx-lib-textbox.mjs +25 -5
  142. package/fesm2020/pepperi-addons-ngx-lib-textbox.mjs.map +1 -1
  143. package/fesm2020/pepperi-addons-ngx-lib.mjs +544 -529
  144. package/fesm2020/pepperi-addons-ngx-lib.mjs.map +1 -1
  145. package/form/internal-carusel.component.d.ts +1 -0
  146. package/form/internal-menu.component.d.ts +1 -2
  147. package/link/link.component.d.ts +3 -1
  148. package/list/list.component.d.ts +1 -1
  149. package/list/list.model.d.ts +1 -2
  150. package/menu/menu.component.d.ts +2 -1
  151. package/menu/menu.model.d.ts +1 -0
  152. package/package.json +1 -1
  153. package/profile-data-views-list/profile-data-view/profile-data-view.component.d.ts +3 -3
  154. package/profile-data-views-list/profile-data-views-card/profile-data-views-card.component.d.ts +5 -4
  155. package/profile-data-views-list/profile-data-views-list.component.d.ts +13 -10
  156. package/profile-data-views-list/profile-data-views-list.model.d.ts +8 -0
  157. package/query-builder/common/model/legacy.d.ts +2 -0
  158. package/query-builder/common/model/operator.d.ts +11 -1
  159. package/query-builder/common/services/query-structure.service.d.ts +1 -0
  160. package/query-builder/query-builder.module.d.ts +7 -3
  161. package/remote-loader/remote-loader.service.d.ts +1 -1
  162. package/rich-html-textarea/rich-html-textarea.component.d.ts +3 -1
  163. package/rich-html-textarea/rich-html-textarea.component.theme.scss +4 -2
  164. package/select-panel/select-panel.component.d.ts +1 -2
  165. package/signature/signature-dialog.component.d.ts +1 -1
  166. package/skeleton-loader/skeleton-loader.component.d.ts +3 -3
  167. package/smart-filters/boolean-filter/boolean-filter.component.d.ts +1 -0
  168. package/smart-filters/common/model/operator.d.ts +1 -0
  169. package/smart-filters/common/model/type.d.ts +1 -1
  170. package/smart-filters/date-filter/date-filter.component.d.ts +1 -0
  171. package/smart-filters/multi-select-filter/multi-select-filter.component.d.ts +1 -0
  172. package/smart-filters/number-filter/number-filter.component.d.ts +1 -0
  173. package/smart-filters/text-filter/text-filter.component.d.ts +1 -0
  174. package/src/assets/i18n/de.ngx-lib.json +4 -1
  175. package/src/assets/i18n/en.ngx-lib.json +7 -1
  176. package/src/core/style/abstracts/mixins.scss +73 -11
  177. package/src/core/style/abstracts/variables.scss +1 -1
  178. package/src/core/style/base/base.scss +5 -3
  179. package/src/core/style/base/typography.scss +2 -1
  180. package/src/core/style/components/button.scss +11 -0
  181. package/src/core/style/components/general.scss +2 -4
  182. package/textbox/textbox.component.d.ts +2 -0
  183. package/theming.scss +5 -1
  184. package/src/assets/images/sail-away.jpg +0 -0
  185. 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 PepCapitalizePipe {
390
- transform(value) {
391
- if (value) {
392
- return value.charAt(0).toUpperCase() + value.slice(1);
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
- PepCapitalizePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepCapitalizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
398
- PepCapitalizePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepCapitalizePipe, name: "pepCapitalize" });
399
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepCapitalizePipe, decorators: [{
400
- type: Pipe,
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 value;
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
- PepEncodePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepEncodePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
413
- PepEncodePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepEncodePipe, name: "pepEncode" });
414
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepEncodePipe, decorators: [{
415
- type: Pipe,
416
- args: [{ name: 'pepEncode' }]
417
- }] });
418
- class PepEscapePipe {
419
- transform(value) {
420
- if (value) {
421
- const v = escape(value);
422
- return v;
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 value;
444
+ return res;
425
445
  }
426
- }
427
- PepEscapePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepEscapePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
428
- PepEscapePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepEscapePipe, name: "pepEscape" });
429
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepEscapePipe, decorators: [{
430
- type: Pipe,
431
- args: [{ name: 'pepEscape' }]
432
- }] });
433
- class PepReplaceLineBreaksPipe {
434
- transform(value) {
435
- const newValue = value.replace(/(<br\ ?\/?>)/g, ' ');
436
- return newValue;
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
- PepReplaceLineBreaksPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepReplaceLineBreaksPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
440
- PepReplaceLineBreaksPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepReplaceLineBreaksPipe, name: "pepReplaceLineBreaks" });
441
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepReplaceLineBreaksPipe, decorators: [{
442
- type: Pipe,
443
- args: [{ name: 'pepReplaceLineBreaks' }]
444
- }] });
445
- class PepDateFormatterPipe {
446
- transform(value, culture, showTime = false) {
447
- let res = '';
448
- value = new Date(value);
449
- if (value) {
450
- res = value.toLocaleDateString(culture || 'en-US');
451
- if (showTime) {
452
- res +=
453
- ' ' +
454
- value.toLocaleTimeString(culture || 'en-US', {
455
- hour: '2-digit',
456
- minute: '2-digit',
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
- return res;
481
+ if (retVal && isNaN(retVal.getTime())) {
482
+ retVal = null;
483
+ }
484
+ return retVal;
461
485
  }
462
- }
463
- PepDateFormatterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepDateFormatterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
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
- res += ' ' + tmpDate.toLocaleTimeString(culture || 'en-US');
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
- return res;
497
+ else {
498
+ return '';
499
+ }
480
500
  }
481
- }
482
- PepDateStringFormatterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepDateStringFormatterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
483
- PepDateStringFormatterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepDateStringFormatterPipe, name: "pepDateStringFormatter" });
484
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepDateStringFormatterPipe, decorators: [{
485
- type: Pipe,
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
- transform(html) {
493
- return this.sanitizer.bypassSecurityTrustHtml(html);
507
+ isJsonString(str) {
508
+ try {
509
+ JSON.parse(str);
510
+ }
511
+ catch (e) {
512
+ return false;
513
+ }
514
+ return true;
494
515
  }
495
- }
496
- 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 });
497
- PepSafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepSafeHtmlPipe, name: "pepSafeHtml" });
498
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSafeHtmlPipe, decorators: [{
499
- type: Pipe,
500
- args: [{ name: 'pepSafeHtml' }]
501
- }], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; } });
502
- class PepSafePipe {
503
- constructor(sanitizer) {
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
- transform(value, type) {
507
- switch (type) {
508
- case 'html':
509
- return this.sanitizer.bypassSecurityTrustHtml(value);
510
- case 'style':
511
- return this.sanitizer.bypassSecurityTrustStyle(value);
512
- case 'script':
513
- return this.sanitizer.bypassSecurityTrustScript(value);
514
- case 'url':
515
- return this.sanitizer.bypassSecurityTrustUrl(value);
516
- case 'resourceUrl':
517
- return this.sanitizer.bypassSecurityTrustResourceUrl(value);
518
- default:
519
- throw new Error(`Invalid safe type specified: ${type}`);
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
- 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 });
524
- PepSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepSafePipe, name: "pepSafe" });
525
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSafePipe, decorators: [{
526
- type: Pipe,
527
- args: [{ name: 'pepSafe' }]
528
- }], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; } });
529
- class PepSplitUppercasePipe {
530
- transform(value) {
531
- const newValue = value.replace(/([a-z])([A-Z])/g, '$1 $2');
532
- return newValue;
533
- }
534
- }
535
- PepSplitUppercasePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSplitUppercasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
536
- PepSplitUppercasePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepSplitUppercasePipe, name: "pepSplitUppercase" });
537
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepSplitUppercasePipe, decorators: [{
538
- type: Pipe,
539
- args: [{ name: 'pepSplitUppercase' }]
540
- }] });
541
- class PepToNumberPipe {
542
- transform(value) {
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
- return value;
585
- }
586
- }
587
- DateAgoPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DateAgoPipe, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe });
588
- DateAgoPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: DateAgoPipe, name: "dateAgo" });
589
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: DateAgoPipe, decorators: [{
590
- type: Pipe,
591
- args: [{
592
- name: 'dateAgo'
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
- ngAfterViewInit() {
604
- if (this.el.nativeElement.tagName.toLowerCase() === 'input') {
605
- this.input = this.el;
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
- const list = this.el.nativeElement.querySelectorAll('input');
609
- this.input = list.length > 0 ? list[0] : null;
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
- if (this.input) {
612
- this.input.addEventListener('blur', this.setWidthUsingText.bind(this));
613
- this.input.addEventListener('keyup', this.setWidthUsingText.bind(this));
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
- ngOnDestroy() {
618
- this.input.removeEventListener('blur', this.setWidthUsingText.bind(this));
619
- this.input.removeEventListener('keyup', this.setWidthUsingText.bind(this));
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
- get paddingWidth() {
622
- return this.includePadding
623
- ? this._sumPropertyValues(['padding-left', 'padding-right'])
624
- : 0;
646
+ incrementNumber(value) {
647
+ let numberValue = coerceNumberProperty(value, 0);
648
+ return (++numberValue).toString();
625
649
  }
626
- get style() {
627
- return getComputedStyle(this.input, '');
650
+ decrementNumber(value) {
651
+ let numberValue = coerceNumberProperty(value, 0);
652
+ return (--numberValue).toString();
628
653
  }
629
- setWidth(width) {
630
- this.renderer.setStyle(this.input, 'width', width + 'px');
654
+ getDecimalSeparator() {
655
+ const numberWithDecimalSeparator = 1.1;
656
+ return numberWithDecimalSeparator
657
+ .toLocaleString(this.culture)
658
+ .substring(1, 2);
631
659
  }
632
- setWidthUsingText() {
633
- if (this.input) {
634
- const text = this.input.value;
635
- this.setWidth(this.textWidth(text) + this.paddingWidth);
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
- _sumPropertyValues(properties) {
639
- return properties
640
- .map((property) => parseInt(this.style.getPropertyValue(property), 10))
641
- .reduce((a, b) => a + b, 0);
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
- 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 });
661
- PepInputAutoWidthDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: PepInputAutoWidthDirective, selector: "[pepAutoWidth]", inputs: { includePadding: "includePadding" }, ngImport: i0 });
662
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepInputAutoWidthDirective, decorators: [{
663
- type: Directive,
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
+ PepUtilitiesServiceprov = 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
- selector: '[pepAutoWidth]',
681
+ providedIn: 'root',
666
682
  }]
667
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { includePadding: [{
668
- type: Input
669
- }] } });
683
+ }], ctorParameters: function () {
684
+ return [{ type: i1.TranslateService, decorators: [{
685
+ type: Optional
686
+ }] }];
687
+ } });
670
688
 
671
- class PepButtonBlurDirective {
672
- constructor(element) {
673
- this.element = element;
674
- }
675
- onClick() {
676
- setTimeout(() => {
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
- PepButtonBlurDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepButtonBlurDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
682
- PepButtonBlurDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.2", type: PepButtonBlurDirective, selector: "[pepButtonBlur]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
683
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepButtonBlurDirective, decorators: [{
684
- type: Directive,
685
- args: [{
686
- selector: '[pepButtonBlur]',
687
- }]
688
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onClick: [{
689
- type: HostListener,
690
- args: ['click']
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
+ PepCapitalizePipepipe = 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 coerceNumberProperty(value, fallbackValue);
709
+ return value;
711
710
  }
712
- // adapted from https://github.com/sindresorhus/parse-ms.
713
- // moved to internal function because parse-ms is now pure ESM.
714
- parseMs(milliseconds) {
715
- if (typeof milliseconds !== 'number') {
716
- throw new TypeError('Expected a number');
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
- // adapted from https://github.com/rafaelrinaldi/add-zero.
727
- // moved to internal function b/c addZero is unmaintained (7+ years).
728
- // stripped out negative sign logic since we're already doing it elsewhere.
729
- addZero(value, digits = 2) {
730
- digits = digits || 2;
731
- let str = value.toString();
732
- let size = 0;
733
- size = digits - str.length + 1;
734
- str = new Array(size).join('0').concat(str);
735
- return str;
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
- isCurrencyShouldBeOnRight(currencySymbol) {
738
- let res = false;
739
- if (currencySymbol == "" ||
740
- currencySymbol == "" ||
741
- currencySymbol == "Ft" ||
742
- currencySymbol == "Kč" ||
743
- currencySymbol == "руб" ||
744
- currencySymbol == "zł" ||
745
- currencySymbol == "kr.") {
746
- res = true;
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
- cutValueByFractionDigits(value, maxFractionDigits) {
751
- let res = value;
752
- maxFractionDigits = maxFractionDigits || 2;
753
- const decimalSeparator = this.getDecimalSeparator();
754
- if (value.includes(decimalSeparator)) {
755
- const valueArr = value.split(decimalSeparator);
756
- // if (valueArr[1].length < maxFractionDigits) {
757
- valueArr[1] = valueArr[1].padEnd(maxFractionDigits, '0');
758
- // }
759
- res = `${valueArr[0]}${decimalSeparator}${valueArr[1].slice(0, maxFractionDigits)}`;
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
- parseDate(dateStr, showTime = false) {
764
- let retVal = null;
765
- if (dateStr !== '') {
766
- retVal = new Date(dateStr);
767
- // Convert to date with no offset.
768
- if (!showTime) {
769
- const index = dateStr.indexOf('T');
770
- if (index > 0) {
771
- dateStr = dateStr.substring(0, index);
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
- stringifyDate(date, showTime = false) {
791
- if (date) {
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
- isValueHtml(value) {
806
- let res = false;
807
- const REGEXP = /<\/?[a-z][\s\S]*>/i;
808
- res = REGEXP.test(value);
809
- return res;
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
- isJsonString(str) {
812
- try {
813
- JSON.parse(str);
814
- }
815
- catch (e) {
816
- return false;
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
- getSvgElementFromString(document, svgContent) {
821
- const div = document.createElement('DIV');
822
- // div.className = 'svg-icon';
823
- // Add class svg-icon
824
- if ((svgContent === null || svgContent === void 0 ? void 0 : svgContent.length) > 0) {
825
- div.innerHTML = svgContent.replace('<svg ', '<svg class="svg-icon" ');
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 (div.querySelector('svg') ||
828
- document.createElementNS('http://www.w3.org/2000/svg', 'path'));
892
+ return value;
829
893
  }
830
- // formatPercent(value: any, digitsInfo = '1.0-2') {
831
- formatPercent(value, minFractionDigits = 0, maxFractionDigits = 2) {
832
- minFractionDigits = coerceNumberProperty(minFractionDigits, null);
833
- maxFractionDigits = coerceNumberProperty(maxFractionDigits, null);
834
- value = this.cutValueByFractionDigits(value === null || value === void 0 ? void 0 : value.toString(), Math.max(minFractionDigits, maxFractionDigits));
835
- const number = this.prepareNumberToFormat(value);
836
- if (number === 0) {
837
- return '0%';
838
- }
839
- else {
840
- // return formatPercent(number / 100, this.culture, digitsInfo);
841
- return new Intl.NumberFormat(this.culture, {
842
- style: 'percent',
843
- minimumFractionDigits: minFractionDigits || 0,
844
- maximumFractionDigits: maxFractionDigits || Math.max(2, minFractionDigits),
845
- }).format(number / 100);
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
- // formatCurrency(value: any, currencySign = '', digitsInfo = '1.2-2') {
849
- formatCurrency(value, currencySign = '', minFractionDigits = 2, maxFractionDigits = 2, useGrouping = true) {
850
- minFractionDigits = coerceNumberProperty(minFractionDigits, null);
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
- // return formatCurrency(value, this.culture, currencySign, undefined, digitsInfo);
872
- res = new Intl.NumberFormat(this.culture, styleOptions).format(number);
916
+ const list = this.el.nativeElement.querySelectorAll('input');
917
+ this.input = list.length > 0 ? list[0] : null;
873
918
  }
874
- if (currencySign.length > 0) {
875
- res = this.isCurrencyShouldBeOnRight(currencySign) ? `${res} ${currencySign}` : `${currencySign} ${res}`;
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
- // formatDecimal(value: any, digitsInfo = '1.2-2') {
881
- formatDecimal(value, minFractionDigits = 2, maxFractionDigits = 2, useGrouping = true) {
882
- minFractionDigits = coerceNumberProperty(minFractionDigits, null);
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
- // formatNumber(value: any, digitsInfo = '1.0-0'): string {
904
- formatNumber(value, useGrouping = true) {
905
- const number = this.prepareNumberToFormat(value);
906
- if (number === 0) {
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
- * Convert a number in milliseconds to a standard duration string.
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
- incrementNumber(value) {
951
- let numberValue = coerceNumberProperty(value, 0);
952
- return (++numberValue).toString();
937
+ setWidth(width) {
938
+ this.renderer.setStyle(this.input, 'width', width + 'px');
953
939
  }
954
- decrementNumber(value) {
955
- let numberValue = coerceNumberProperty(value, 0);
956
- return (--numberValue).toString();
940
+ setWidthUsingText() {
941
+ if (this.input) {
942
+ const text = this.input.value;
943
+ this.setWidth(this.textWidth(text) + this.paddingWidth);
944
+ }
957
945
  }
958
- getDecimalSeparator() {
959
- const numberWithDecimalSeparator = 1.1;
960
- return numberWithDecimalSeparator
961
- .toLocaleString(this.culture)
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
- changeDecimalSeparatorWhenItsComma(value, reverse = false) {
965
- // If the decimal separator is ','
966
- if (this.getDecimalSeparator() === ',') {
967
- // In case that the value isn't string.
968
- value = (value === null || value === void 0 ? void 0 : value.toString()) || '';
969
- // If reverse change the number from '.' to ',' else do the opposite.
970
- value = reverse ? value.replace('.', ',') : value.replace(',', '.');
971
- }
972
- return value;
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
- isEqualNumber(numberAsString, numberAsString2) {
975
- const number = this.prepareNumberToFormat(numberAsString);
976
- const number2 = this.prepareNumberToFormat(numberAsString2);
977
- return number === number2;
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
- 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 });
981
- PepUtilitiesServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepUtilitiesService, providedIn: 'root' });
982
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepUtilitiesService, decorators: [{
983
- type: Injectable,
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
+ PepButtonBlurDirectivedir = 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
- providedIn: 'root',
994
+ selector: '[pepButtonBlur]',
986
995
  }]
987
- }], ctorParameters: function () {
988
- return [{ type: i1.TranslateService, decorators: [{
989
- type: Optional
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() {