@pumpkin-tech/pumpkin-tech-ng 0.2.56 → 0.2.58

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.
@@ -8,7 +8,7 @@ import { coerceBooleanProperty } from '@angular/cdk/coercion';
8
8
  import * as i2 from '@angular/forms';
9
9
  import { FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR, FormControl } from '@angular/forms';
10
10
  import * as i1$1 from '@angular/common';
11
- import { CommonModule, NgIf, CurrencyPipe, formatNumber, formatDate, formatCurrency } from '@angular/common';
11
+ import { CommonModule, NgIf, formatDate, CurrencyPipe, formatNumber, formatCurrency } from '@angular/common';
12
12
  import * as i3$3 from '@angular/material/toolbar';
13
13
  import { MatToolbarModule } from '@angular/material/toolbar';
14
14
  import * as i5$1 from '@angular/material/sidenav';
@@ -8466,6 +8466,7 @@ class PtechAutocompleteComponent extends BaseField {
8466
8466
  this.value = value;
8467
8467
  this.selectedValues = Array.isArray(value) ? [...value] : [];
8468
8468
  this.searchText = !this.multiple && value ? this.getDisplay(value) : '';
8469
+ this.cdr.markForCheck();
8469
8470
  }
8470
8471
  registerOnChange(fn) { this.onChange = fn; }
8471
8472
  registerOnTouched(fn) { this.onTouched = fn; }
@@ -8497,6 +8498,7 @@ class PtechAutocompleteComponent extends BaseField {
8497
8498
  }
8498
8499
  this.onChange(this.value);
8499
8500
  this.selectionChange.emit(this.value);
8501
+ this.cdr.markForCheck();
8500
8502
  }
8501
8503
  clear() {
8502
8504
  this.value = this.multiple ? [] : null;
@@ -8505,12 +8507,14 @@ class PtechAutocompleteComponent extends BaseField {
8505
8507
  this.filteredOptions = [];
8506
8508
  this.onChange(this.value);
8507
8509
  this.selectionChange.emit(this.value);
8510
+ this.cdr.markForCheck();
8508
8511
  }
8509
8512
  removeSelected(selected) {
8510
8513
  this.selectedValues = this.selectedValues.filter(item => !this.sameValue(item, selected));
8511
8514
  this.value = this.selectedValues;
8512
8515
  this.onChange(this.value);
8513
8516
  this.selectionChange.emit(this.value);
8517
+ this.cdr.markForCheck();
8514
8518
  }
8515
8519
  displaySelected = (value) => value ? this.getDisplay(value) : '';
8516
8520
  getDisplay(value) {
@@ -9974,6 +9978,7 @@ class PtechTimezoneClockComponent {
9974
9978
  showTimezone = true;
9975
9979
  showSeconds = false;
9976
9980
  time = '';
9981
+ effectiveZoneId = 'UTC';
9977
9982
  tickSubscription;
9978
9983
  constructor(cdr) {
9979
9984
  this.cdr = cdr;
@@ -9998,34 +10003,48 @@ class PtechTimezoneClockComponent {
9998
10003
  this.tickSubscription = interval(this.showSeconds ? 1000 : 30000).subscribe(() => this.tick());
9999
10004
  }
10000
10005
  tick() {
10001
- if (!this.zoneId) {
10002
- this.time = '';
10003
- this.cdr.markForCheck();
10004
- return;
10005
- }
10006
+ this.effectiveZoneId = this.resolveZoneId(this.zoneId);
10006
10007
  try {
10007
10008
  this.time = new Intl.DateTimeFormat('pt-BR', {
10008
- timeZone: this.zoneId,
10009
+ timeZone: this.effectiveZoneId,
10009
10010
  hour: '2-digit',
10010
10011
  minute: '2-digit',
10011
10012
  second: this.showSeconds ? '2-digit' : undefined,
10012
10013
  }).format(new Date());
10013
10014
  }
10014
10015
  catch {
10015
- this.time = '';
10016
+ this.effectiveZoneId = 'UTC';
10017
+ this.time = new Intl.DateTimeFormat('pt-BR', {
10018
+ timeZone: this.effectiveZoneId,
10019
+ hour: '2-digit',
10020
+ minute: '2-digit',
10021
+ second: this.showSeconds ? '2-digit' : undefined,
10022
+ }).format(new Date());
10016
10023
  }
10017
10024
  this.cdr.markForCheck();
10018
10025
  }
10026
+ resolveZoneId(zoneId) {
10027
+ const candidate = (zoneId || '').trim();
10028
+ if (!candidate) {
10029
+ return 'UTC';
10030
+ }
10031
+ try {
10032
+ new Intl.DateTimeFormat('pt-BR', { timeZone: candidate }).format(new Date());
10033
+ return candidate;
10034
+ }
10035
+ catch {
10036
+ return 'UTC';
10037
+ }
10038
+ }
10019
10039
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechTimezoneClockComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
10020
10040
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: PtechTimezoneClockComponent, isStandalone: true, selector: "ptech-timezone-clock", inputs: { zoneId: "zoneId", compact: "compact", showTimezone: "showTimezone", showSeconds: "showSeconds" }, usesOnChanges: true, ngImport: i0, template: `
10021
10041
  <span
10022
10042
  class="ptech-timezone-clock"
10023
10043
  [class.compact]="compact"
10024
- *ngIf="zoneId"
10025
- [title]="showTimezone ? zoneId : ''"
10044
+ [title]="showTimezone ? effectiveZoneId : ''"
10026
10045
  >
10027
10046
  <span class="ptech-timezone-clock-time">{{ time }}</span>
10028
- <span class="ptech-timezone-clock-zone" *ngIf="showTimezone"> — {{ zoneId }}</span>
10047
+ <span class="ptech-timezone-clock-zone" *ngIf="showTimezone"> • {{ effectiveZoneId }}</span>
10029
10048
  </span>
10030
10049
  `, isInline: true, styles: [".ptech-timezone-clock{font-size:var(--ptech-timezone-clock-font-size, 12px);color:var(--ptech-timezone-clock-color, inherit);opacity:var(--ptech-timezone-clock-opacity, .85);white-space:nowrap;font-variant-numeric:tabular-nums}@media (max-width: 599.98px){.ptech-timezone-clock.compact .ptech-timezone-clock-zone{display:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
10031
10050
  }
@@ -10035,11 +10054,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10035
10054
  <span
10036
10055
  class="ptech-timezone-clock"
10037
10056
  [class.compact]="compact"
10038
- *ngIf="zoneId"
10039
- [title]="showTimezone ? zoneId : ''"
10057
+ [title]="showTimezone ? effectiveZoneId : ''"
10040
10058
  >
10041
10059
  <span class="ptech-timezone-clock-time">{{ time }}</span>
10042
- <span class="ptech-timezone-clock-zone" *ngIf="showTimezone"> — {{ zoneId }}</span>
10060
+ <span class="ptech-timezone-clock-zone" *ngIf="showTimezone"> • {{ effectiveZoneId }}</span>
10043
10061
  </span>
10044
10062
  `, styles: [".ptech-timezone-clock{font-size:var(--ptech-timezone-clock-font-size, 12px);color:var(--ptech-timezone-clock-color, inherit);opacity:var(--ptech-timezone-clock-opacity, .85);white-space:nowrap;font-variant-numeric:tabular-nums}@media (max-width: 599.98px){.ptech-timezone-clock.compact .ptech-timezone-clock-zone{display:none}}\n"] }]
10045
10063
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { zoneId: [{
@@ -10052,6 +10070,231 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10052
10070
  type: Input
10053
10071
  }] } });
10054
10072
 
10073
+ class DateUtil {
10074
+ static DATE_FORMAT = 'dd/MM/yyyy';
10075
+ static TIME_HOUR_MINUTE_FORMAT = 'HH:mm';
10076
+ static TIME_HOUR_MINUTE_SEC_FORMAT = 'HH:mm:ss';
10077
+ static DATE_TIME_FORMAT = 'dd/MM/yyyy HH:mm';
10078
+ static DATE_TIME_FORMAT_SLICED = 'dd/MM/yy HH:mm';
10079
+ static DATE_TIME_FULL_FORMAT = 'dd/MM/yyyy HH:mm:ss';
10080
+ static DEFAULT_TIME_ZONE = 'UTC';
10081
+ /**
10082
+ * Aceita Date | string | undefined. Retorna string formatada ou vazio.
10083
+ */
10084
+ static format(value, format) {
10085
+ if (!value)
10086
+ return StringUtil.EMPTY;
10087
+ const dateObj = typeof value === 'string' ? new Date(value) : value;
10088
+ if (dateObj instanceof Date && !isNaN(dateObj.getTime())) {
10089
+ return formatDate(dateObj, format, 'pt-BR');
10090
+ }
10091
+ return StringUtil.EMPTY;
10092
+ }
10093
+ static formatDateToZone(utcDate, timezone, locale = 'pt-BR') {
10094
+ if (!utcDate)
10095
+ return StringUtil.EMPTY;
10096
+ const date = utcDate instanceof Date ? utcDate : new Date(utcDate);
10097
+ if (!this.isValid(date))
10098
+ return StringUtil.EMPTY;
10099
+ const zoneId = this.resolveZoneId(timezone);
10100
+ return new Intl.DateTimeFormat(locale, {
10101
+ timeZone: zoneId,
10102
+ day: '2-digit',
10103
+ month: '2-digit',
10104
+ year: 'numeric',
10105
+ hour: '2-digit',
10106
+ minute: '2-digit',
10107
+ hour12: false,
10108
+ }).format(date).replace(',', '');
10109
+ }
10110
+ static getTimeFormat(value, format) {
10111
+ if (!this.isValid(value))
10112
+ return StringUtil.EMPTY;
10113
+ const date = value instanceof Date ? value : new Date(value);
10114
+ const hour = String(date.getHours()).padStart(2, '0');
10115
+ const minute = String(date.getMinutes()).padStart(2, '0');
10116
+ const second = String(date.getSeconds()).padStart(2, '0');
10117
+ if (format === this.TIME_HOUR_MINUTE_FORMAT) {
10118
+ return `${hour}:${minute}`;
10119
+ }
10120
+ if (format === this.TIME_HOUR_MINUTE_SEC_FORMAT) {
10121
+ return `${hour}:${minute}:${second}`;
10122
+ }
10123
+ return StringUtil.EMPTY;
10124
+ }
10125
+ static getTotalDaysInMonth(month, year) {
10126
+ const date = new Date(year, month - 1, 1);
10127
+ date.setMonth(date.getMonth() + 1);
10128
+ date.setDate(date.getDate() - 1);
10129
+ return date.getDate();
10130
+ }
10131
+ static addMonthsToDate(date, monthsToAdd) {
10132
+ const resultDate = new Date(date);
10133
+ resultDate.setMonth(resultDate.getMonth() + monthsToAdd);
10134
+ return resultDate;
10135
+ }
10136
+ static addDaysToDate(days, date) {
10137
+ const result = new Date(date);
10138
+ result.setDate(result.getDate() + days);
10139
+ return result;
10140
+ }
10141
+ static isValid(value) {
10142
+ if (value === null || value === undefined)
10143
+ return false;
10144
+ const date = typeof value === 'string' ? new Date(value) : value;
10145
+ return date instanceof Date && !isNaN(date.getTime());
10146
+ }
10147
+ static isGreaterThan(initial, final) {
10148
+ const i = new Date(initial);
10149
+ const f = new Date(final);
10150
+ return this.isValid(i) && this.isValid(f) && i > f;
10151
+ }
10152
+ static isLessThan(initial, final) {
10153
+ const i = new Date(initial);
10154
+ const f = new Date(final);
10155
+ return this.isValid(i) && this.isValid(f) && i < f;
10156
+ }
10157
+ static isEqual(initial, final) {
10158
+ const i = new Date(initial);
10159
+ const f = new Date(final);
10160
+ return this.isValid(i) && this.isValid(f) && i.getTime() === f.getTime();
10161
+ }
10162
+ static isLessThanOrEqual(initial, final) {
10163
+ return this.isLessThan(initial, final) || this.isEqual(initial, final);
10164
+ }
10165
+ static isGreaterThanOrEqual(initial, final) {
10166
+ return this.isGreaterThan(initial, final) || this.isEqual(initial, final);
10167
+ }
10168
+ static isBetween(date, initial, final) {
10169
+ const d = new Date(date);
10170
+ const i = new Date(initial);
10171
+ const f = new Date(final);
10172
+ return this.isValid(d) && this.isValid(i) && this.isValid(f) && d >= i && d <= f;
10173
+ }
10174
+ static getDayOfWeek(date) {
10175
+ // getDay returns 0=Sunday
10176
+ switch (date.getDay()) {
10177
+ case 0:
10178
+ return 'SUNDAY';
10179
+ case 1:
10180
+ return 'MONDAY';
10181
+ case 2:
10182
+ return 'TUESDAY';
10183
+ case 3:
10184
+ return 'WEDNESDAY';
10185
+ case 4:
10186
+ return 'THURSDAY';
10187
+ case 5:
10188
+ return 'FRIDAY';
10189
+ case 6:
10190
+ return 'SATURDAY';
10191
+ }
10192
+ return '';
10193
+ }
10194
+ static isValidWithString(value, pattern) {
10195
+ if (!value || value.length < pattern.length)
10196
+ return false;
10197
+ return this.isValid(this.stringToDate(value, pattern));
10198
+ }
10199
+ static stringToDate(date, pattern, zoned = false) {
10200
+ const dateItems = date.replace(/[^a-zA-Z0-9]/g, '-').split('-');
10201
+ const formatItems = pattern.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-').split('-');
10202
+ const yearIndex = formatItems.indexOf('yyyy');
10203
+ const monthIndex = formatItems.indexOf('mm');
10204
+ const dayIndex = formatItems.indexOf('dd');
10205
+ const hourIndex = formatItems.indexOf('hh');
10206
+ const minutesIndex = formatItems.indexOf('ii');
10207
+ const secondsIndex = formatItems.indexOf('ss');
10208
+ const year = yearIndex > -1 ? Number(dateItems[yearIndex]) : 1970;
10209
+ const month = monthIndex > -1 ? Number(dateItems[monthIndex]) - 1 : 0;
10210
+ const day = dayIndex > -1 ? Number(dateItems[dayIndex]) : 1;
10211
+ const hour = hourIndex > -1 ? Number(dateItems[hourIndex]) : 0;
10212
+ const minute = minutesIndex > -1 ? Number(dateItems[minutesIndex]) : 0;
10213
+ const second = secondsIndex > -1 ? Number(dateItems[secondsIndex]) : 0;
10214
+ if (zoned) {
10215
+ return new Date(Date.UTC(year, month, day, hour, minute, second));
10216
+ }
10217
+ return new Date(Date.UTC(year, month, day, hour, minute, second));
10218
+ }
10219
+ static dateAndStringHourToDate(date, hour) {
10220
+ if (!this.isValid(date) || !hour)
10221
+ return new Date(NaN);
10222
+ const [hours = '0', minutes = '0'] = hour.split(':');
10223
+ const result = new Date(date);
10224
+ result.setHours(Number(hours), Number(minutes), 0, 0);
10225
+ return result;
10226
+ }
10227
+ static stringFormattedToDate(date) {
10228
+ if (!date)
10229
+ return undefined;
10230
+ const parsed = this.stringToDate(date, 'dd/mm/yyyy');
10231
+ return this.isValid(parsed) ? parsed : undefined;
10232
+ }
10233
+ static resolveZoneId(timezone) {
10234
+ const candidate = (timezone || '').trim();
10235
+ if (candidate && this.isSupportedTimeZone(candidate)) {
10236
+ return candidate;
10237
+ }
10238
+ return this.DEFAULT_TIME_ZONE;
10239
+ }
10240
+ static isSupportedTimeZone(timezone) {
10241
+ try {
10242
+ new Intl.DateTimeFormat('en-US', { timeZone: timezone }).format(new Date());
10243
+ return true;
10244
+ }
10245
+ catch {
10246
+ return false;
10247
+ }
10248
+ }
10249
+ }
10250
+
10251
+ class PtechLogsComponent {
10252
+ model;
10253
+ updatedLabel = 'Atualizado em';
10254
+ atLabel = 'às';
10255
+ systemLabel = 'por sistema';
10256
+ dateFormat = 'dd/MM/yyyy';
10257
+ timeFormat = 'HH:mm';
10258
+ message = '';
10259
+ ngOnChanges(_) {
10260
+ this.message = this.buildMessage();
10261
+ }
10262
+ buildMessage() {
10263
+ if (!this.model) {
10264
+ return '';
10265
+ }
10266
+ const date = this.model.lastUpdateDate || this.model.creationDate;
10267
+ if (!date) {
10268
+ return '';
10269
+ }
10270
+ const formattedDate = DateUtil.format(date, this.dateFormat);
10271
+ const formattedTime = DateUtil.format(date, this.timeFormat);
10272
+ if (!formattedDate || !formattedTime) {
10273
+ return '';
10274
+ }
10275
+ const base = `${this.updatedLabel} ${formattedDate} ${this.atLabel} ${formattedTime}`;
10276
+ return this.model.changedBy ? base : `${base} - ${this.systemLabel}`;
10277
+ }
10278
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechLogsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10279
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: PtechLogsComponent, isStandalone: true, selector: "ptech-logs", inputs: { model: "model", updatedLabel: "updatedLabel", atLabel: "atLabel", systemLabel: "systemLabel", dateFormat: "dateFormat", timeFormat: "timeFormat" }, usesOnChanges: true, ngImport: i0, template: `<p class="ptech-log" *ngIf="message">{{ message }}</p>`, isInline: true, styles: [".ptech-log{font-family:var(--ptech-font-family, Poppins, \"Helvetica Neue\", sans-serif);font-size:var(--ptech-log-font-size, 11px);line-height:1.35;color:var(--ptech-log-color, rgba(137, 137, 137, .75));margin:var(--ptech-log-margin, -10px 0 0)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
10280
+ }
10281
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechLogsComponent, decorators: [{
10282
+ type: Component,
10283
+ args: [{ selector: 'ptech-logs', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `<p class="ptech-log" *ngIf="message">{{ message }}</p>`, styles: [".ptech-log{font-family:var(--ptech-font-family, Poppins, \"Helvetica Neue\", sans-serif);font-size:var(--ptech-log-font-size, 11px);line-height:1.35;color:var(--ptech-log-color, rgba(137, 137, 137, .75));margin:var(--ptech-log-margin, -10px 0 0)}\n"] }]
10284
+ }], propDecorators: { model: [{
10285
+ type: Input
10286
+ }], updatedLabel: [{
10287
+ type: Input
10288
+ }], atLabel: [{
10289
+ type: Input
10290
+ }], systemLabel: [{
10291
+ type: Input
10292
+ }], dateFormat: [{
10293
+ type: Input
10294
+ }], timeFormat: [{
10295
+ type: Input
10296
+ }] } });
10297
+
10055
10298
  class SnackbarMessageService {
10056
10299
  snackBar;
10057
10300
  constructor(snackBar) {
@@ -10170,7 +10413,8 @@ class PumpkinTechModule {
10170
10413
  PtechWidgetMenuComponent,
10171
10414
  PtechCarouselComponent,
10172
10415
  PtechTimelineComponent,
10173
- PtechTimezoneClockComponent], exports: [
10416
+ PtechTimezoneClockComponent,
10417
+ PtechLogsComponent], exports: [
10174
10418
  // reexporta tudo junto
10175
10419
  InputComponent,
10176
10420
  TextareaComponent,
@@ -10220,6 +10464,7 @@ class PumpkinTechModule {
10220
10464
  PtechCarouselComponent,
10221
10465
  PtechTimelineComponent,
10222
10466
  PtechTimezoneClockComponent,
10467
+ PtechLogsComponent,
10223
10468
  CoreMaterialModule] });
10224
10469
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PumpkinTechModule, providers: [
10225
10470
  {
@@ -10274,7 +10519,8 @@ class PumpkinTechModule {
10274
10519
  PtechWidgetMenuComponent,
10275
10520
  PtechCarouselComponent,
10276
10521
  PtechTimelineComponent,
10277
- PtechTimezoneClockComponent, CoreMaterialModule] });
10522
+ PtechTimezoneClockComponent,
10523
+ PtechLogsComponent, CoreMaterialModule] });
10278
10524
  }
10279
10525
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PumpkinTechModule, decorators: [{
10280
10526
  type: NgModule,
@@ -10330,7 +10576,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10330
10576
  PtechWidgetMenuComponent,
10331
10577
  PtechCarouselComponent,
10332
10578
  PtechTimelineComponent,
10333
- PtechTimezoneClockComponent
10579
+ PtechTimezoneClockComponent,
10580
+ PtechLogsComponent
10334
10581
  ],
10335
10582
  exports: [
10336
10583
  // reexporta tudo junto
@@ -10382,6 +10629,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10382
10629
  PtechCarouselComponent,
10383
10630
  PtechTimelineComponent,
10384
10631
  PtechTimezoneClockComponent,
10632
+ PtechLogsComponent,
10385
10633
  CoreMaterialModule,
10386
10634
  ],
10387
10635
  providers: [
@@ -10878,6 +11126,125 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10878
11126
  }]
10879
11127
  }] });
10880
11128
 
11129
+ // currency-preference.service.ts
11130
+ const CURRENCY_KEY = 'currency_preference';
11131
+ const DEFAULT_CURRENCY = 'EUR';
11132
+ const CURRENCY_MAP = {
11133
+ EUR: {
11134
+ symbol: '€',
11135
+ thousandSeparator: '.',
11136
+ decimalMarker: ',',
11137
+ placeholder: '0,00',
11138
+ locale: 'de-DE', // uso de padrão europeu para vírgula decimal
11139
+ },
11140
+ USD: {
11141
+ symbol: '$',
11142
+ thousandSeparator: ',',
11143
+ decimalMarker: '.',
11144
+ placeholder: '0.00',
11145
+ locale: 'en-US',
11146
+ },
11147
+ BRL: {
11148
+ symbol: 'R$',
11149
+ thousandSeparator: '.',
11150
+ decimalMarker: ',',
11151
+ placeholder: '0,00',
11152
+ locale: 'pt-BR',
11153
+ },
11154
+ };
11155
+ class CurrencyPreferenceService {
11156
+ _currency = DEFAULT_CURRENCY;
11157
+ _subject = new BehaviorSubject(DEFAULT_CURRENCY);
11158
+ currency$ = this._subject.asObservable();
11159
+ constructor() {
11160
+ this.loadInitialCurrency();
11161
+ }
11162
+ loadInitialCurrency() {
11163
+ const stored = localStorage.getItem(CURRENCY_KEY);
11164
+ if (stored && this.isSupported(stored)) {
11165
+ this._setCurrencyInternal(stored);
11166
+ }
11167
+ else {
11168
+ // opcional: inferir da locale do navegador
11169
+ // const inferred = navigator.language.startsWith('pt') ? 'BRL' : 'EUR';
11170
+ this._setCurrencyInternal(this._currency);
11171
+ }
11172
+ }
11173
+ isSupported(code) {
11174
+ return code in CURRENCY_MAP;
11175
+ }
11176
+ _setCurrencyInternal(newCurrency) {
11177
+ this._currency = newCurrency;
11178
+ this._subject.next(newCurrency);
11179
+ }
11180
+ getCurrency() {
11181
+ return this._currency;
11182
+ }
11183
+ setCurrency(newCurrency) {
11184
+ if (!this.isSupported(newCurrency)) {
11185
+ console.warn(`Currency ${newCurrency} not supported. Falling back to default.`);
11186
+ newCurrency = DEFAULT_CURRENCY;
11187
+ }
11188
+ this._setCurrencyInternal(newCurrency);
11189
+ localStorage.setItem(CURRENCY_KEY, newCurrency);
11190
+ }
11191
+ getCurrencySymbol() {
11192
+ return CURRENCY_MAP[this._currency].symbol;
11193
+ }
11194
+ getThousandSeparator() {
11195
+ return CURRENCY_MAP[this._currency].thousandSeparator;
11196
+ }
11197
+ getDecimalMarker() {
11198
+ return CURRENCY_MAP[this._currency].decimalMarker;
11199
+ }
11200
+ getPlaceholder() {
11201
+ return CURRENCY_MAP[this._currency].placeholder;
11202
+ }
11203
+ formatAmount(value, options) {
11204
+ const meta = CURRENCY_MAP[this._currency];
11205
+ const formatter = new Intl.NumberFormat(meta.locale, {
11206
+ style: 'currency',
11207
+ currency: this._currency === 'BRL' ? 'BRL' : this._currency, // map if codes diferem
11208
+ minimumFractionDigits: options?.minimumFractionDigits ?? 2,
11209
+ maximumFractionDigits: options?.maximumFractionDigits ?? 2,
11210
+ currencyDisplay: options?.useSymbol === false ? 'code' : 'symbol',
11211
+ });
11212
+ return formatter.format(value);
11213
+ }
11214
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11215
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, providedIn: 'root' });
11216
+ }
11217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, decorators: [{
11218
+ type: Injectable,
11219
+ args: [{
11220
+ providedIn: 'root',
11221
+ }]
11222
+ }], ctorParameters: () => [] });
11223
+
11224
+ class PtechCurrencyPipe {
11225
+ currencyPreferenceService;
11226
+ constructor(currencyPreferenceService) {
11227
+ this.currencyPreferenceService = currencyPreferenceService;
11228
+ }
11229
+ transform(value, minimumFractionDigits = 2, maximumFractionDigits = 2, useSymbol = true) {
11230
+ return this.currencyPreferenceService.formatAmount(value ?? 0, {
11231
+ minimumFractionDigits,
11232
+ maximumFractionDigits,
11233
+ useSymbol,
11234
+ });
11235
+ }
11236
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechCurrencyPipe, deps: [{ token: CurrencyPreferenceService }], target: i0.ɵɵFactoryTarget.Pipe });
11237
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: PtechCurrencyPipe, isStandalone: true, name: "ptechCurrency", pure: false });
11238
+ }
11239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechCurrencyPipe, decorators: [{
11240
+ type: Pipe,
11241
+ args: [{
11242
+ name: 'ptechCurrency',
11243
+ standalone: true,
11244
+ pure: false,
11245
+ }]
11246
+ }], ctorParameters: () => [{ type: CurrencyPreferenceService }] });
11247
+
10881
11248
  class DateAgoPipe {
10882
11249
  intervals = {
10883
11250
  ano: 31536000,
@@ -11212,6 +11579,7 @@ class PipesModule {
11212
11579
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
11213
11580
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: PipesModule, imports: [CommonModule,
11214
11581
  CurrencyBrlPipe,
11582
+ PtechCurrencyPipe,
11215
11583
  DateAgoPipe,
11216
11584
  GetFirstStringBeforeSpacePipe,
11217
11585
  LineBreakAfterPeriodPipe,
@@ -11222,6 +11590,7 @@ class PipesModule {
11222
11590
  UptimeFormatPipe,
11223
11591
  TimeDurationPipe,
11224
11592
  IsLongerThanPipe], exports: [CurrencyBrlPipe,
11593
+ PtechCurrencyPipe,
11225
11594
  DateAgoPipe,
11226
11595
  GetFirstStringBeforeSpacePipe,
11227
11596
  LineBreakAfterPeriodPipe,
@@ -11240,6 +11609,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11240
11609
  imports: [
11241
11610
  CommonModule,
11242
11611
  CurrencyBrlPipe,
11612
+ PtechCurrencyPipe,
11243
11613
  DateAgoPipe,
11244
11614
  GetFirstStringBeforeSpacePipe,
11245
11615
  LineBreakAfterPeriodPipe,
@@ -11253,6 +11623,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11253
11623
  ],
11254
11624
  exports: [
11255
11625
  CurrencyBrlPipe,
11626
+ PtechCurrencyPipe,
11256
11627
  DateAgoPipe,
11257
11628
  GetFirstStringBeforeSpacePipe,
11258
11629
  LineBreakAfterPeriodPipe,
@@ -11392,101 +11763,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11392
11763
  }]
11393
11764
  }] });
11394
11765
 
11395
- // currency-preference.service.ts
11396
- const CURRENCY_KEY = 'currency_preference';
11397
- const DEFAULT_CURRENCY = 'EUR';
11398
- const CURRENCY_MAP = {
11399
- EUR: {
11400
- symbol: '€',
11401
- thousandSeparator: '.',
11402
- decimalMarker: ',',
11403
- placeholder: '0,00',
11404
- locale: 'de-DE', // uso de padrão europeu para vírgula decimal
11405
- },
11406
- USD: {
11407
- symbol: '$',
11408
- thousandSeparator: ',',
11409
- decimalMarker: '.',
11410
- placeholder: '0.00',
11411
- locale: 'en-US',
11412
- },
11413
- BRL: {
11414
- symbol: 'R$',
11415
- thousandSeparator: '.',
11416
- decimalMarker: ',',
11417
- placeholder: '0,00',
11418
- locale: 'pt-BR',
11419
- },
11420
- };
11421
- class CurrencyPreferenceService {
11422
- _currency = DEFAULT_CURRENCY;
11423
- _subject = new BehaviorSubject(DEFAULT_CURRENCY);
11424
- currency$ = this._subject.asObservable();
11425
- constructor() {
11426
- this.loadInitialCurrency();
11427
- }
11428
- loadInitialCurrency() {
11429
- const stored = localStorage.getItem(CURRENCY_KEY);
11430
- if (stored && this.isSupported(stored)) {
11431
- this._setCurrencyInternal(stored);
11432
- }
11433
- else {
11434
- // opcional: inferir da locale do navegador
11435
- // const inferred = navigator.language.startsWith('pt') ? 'BRL' : 'EUR';
11436
- this._setCurrencyInternal(this._currency);
11437
- }
11438
- }
11439
- isSupported(code) {
11440
- return code in CURRENCY_MAP;
11441
- }
11442
- _setCurrencyInternal(newCurrency) {
11443
- this._currency = newCurrency;
11444
- this._subject.next(newCurrency);
11445
- }
11446
- getCurrency() {
11447
- return this._currency;
11448
- }
11449
- setCurrency(newCurrency) {
11450
- if (!this.isSupported(newCurrency)) {
11451
- console.warn(`Currency ${newCurrency} not supported. Falling back to default.`);
11452
- newCurrency = DEFAULT_CURRENCY;
11453
- }
11454
- this._setCurrencyInternal(newCurrency);
11455
- localStorage.setItem(CURRENCY_KEY, newCurrency);
11456
- }
11457
- getCurrencySymbol() {
11458
- return CURRENCY_MAP[this._currency].symbol;
11459
- }
11460
- getThousandSeparator() {
11461
- return CURRENCY_MAP[this._currency].thousandSeparator;
11462
- }
11463
- getDecimalMarker() {
11464
- return CURRENCY_MAP[this._currency].decimalMarker;
11465
- }
11466
- getPlaceholder() {
11467
- return CURRENCY_MAP[this._currency].placeholder;
11468
- }
11469
- formatAmount(value, options) {
11470
- const meta = CURRENCY_MAP[this._currency];
11471
- const formatter = new Intl.NumberFormat(meta.locale, {
11472
- style: 'currency',
11473
- currency: this._currency === 'BRL' ? 'BRL' : this._currency, // map if codes diferem
11474
- minimumFractionDigits: options?.minimumFractionDigits ?? 2,
11475
- maximumFractionDigits: options?.maximumFractionDigits ?? 2,
11476
- currencyDisplay: options?.useSymbol === false ? 'code' : 'symbol',
11477
- });
11478
- return formatter.format(value);
11479
- }
11480
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11481
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, providedIn: 'root' });
11482
- }
11483
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, decorators: [{
11484
- type: Injectable,
11485
- args: [{
11486
- providedIn: 'root',
11487
- }]
11488
- }], ctorParameters: () => [] });
11489
-
11490
11766
  /**
11491
11767
  * Se o app consumidor quiser inserir dinamicamente
11492
11768
  * o crumb de “módulo” (ou qualquer outro prefixo),
@@ -11572,84 +11848,6 @@ class NumberUtil {
11572
11848
  }
11573
11849
  }
11574
11850
 
11575
- // src/lib/utils/date.util.ts
11576
- class DateUtil {
11577
- static DATE_FORMAT = 'dd/MM/yyyy';
11578
- static DATE_TIME_FORMAT = 'dd/MM/yyyy HH:mm';
11579
- static DATE_TIME_FORMAT_SLICED = 'dd/MM/yy HH:mm';
11580
- static DATE_TIME_FULL_FORMAT = 'dd/MM/yyyy HH:mm:ss';
11581
- /**
11582
- * Aceita Date | string | undefined. Retorna string formatada ou vazio.
11583
- */
11584
- static format(value, format) {
11585
- if (!value)
11586
- return StringUtil.EMPTY;
11587
- const dateObj = typeof value === 'string' ? new Date(value) : value;
11588
- if (dateObj instanceof Date && !isNaN(dateObj.getTime())) {
11589
- return formatDate(dateObj, format, 'pt-BR');
11590
- }
11591
- return StringUtil.EMPTY;
11592
- }
11593
- static getTotalDaysInMonth(month, year) {
11594
- const date = new Date(year, month - 1, 1);
11595
- date.setMonth(date.getMonth() + 1);
11596
- date.setDate(date.getDate() - 1);
11597
- return date.getDate();
11598
- }
11599
- static addMonthsToDate(date, monthsToAdd) {
11600
- const resultDate = new Date(date);
11601
- resultDate.setMonth(resultDate.getMonth() + monthsToAdd);
11602
- return resultDate;
11603
- }
11604
- static addDaysToDate(days, date) {
11605
- const result = new Date(date);
11606
- result.setDate(result.getDate() + days);
11607
- return result;
11608
- }
11609
- static isValid(value) {
11610
- if (value === null || value === undefined)
11611
- return false;
11612
- const date = typeof value === 'string' ? new Date(value) : value;
11613
- return date instanceof Date && !isNaN(date.getTime());
11614
- }
11615
- static isGreaterThan(initial, final) {
11616
- const i = new Date(initial);
11617
- const f = new Date(final);
11618
- return this.isValid(i) && this.isValid(f) && i > f;
11619
- }
11620
- static isLessThan(initial, final) {
11621
- const i = new Date(initial);
11622
- const f = new Date(final);
11623
- return this.isValid(i) && this.isValid(f) && i < f;
11624
- }
11625
- static isBetween(date, initial, final) {
11626
- const d = new Date(date);
11627
- const i = new Date(initial);
11628
- const f = new Date(final);
11629
- return this.isValid(d) && this.isValid(i) && this.isValid(f) && d >= i && d <= f;
11630
- }
11631
- static getDayOfWeek(date) {
11632
- // getDay returns 0=Sunday
11633
- switch (date.getDay()) {
11634
- case 0:
11635
- return 'SUNDAY';
11636
- case 1:
11637
- return 'MONDAY';
11638
- case 2:
11639
- return 'TUESDAY';
11640
- case 3:
11641
- return 'WEDNESDAY';
11642
- case 4:
11643
- return 'THURSDAY';
11644
- case 5:
11645
- return 'FRIDAY';
11646
- case 6:
11647
- return 'SATURDAY';
11648
- }
11649
- return '';
11650
- }
11651
- }
11652
-
11653
11851
  // src/lib/utils/currency.util.ts
11654
11852
  class CurrencyUtil {
11655
11853
  /**
@@ -11773,6 +11971,18 @@ class UuidUtil {
11773
11971
  }
11774
11972
  }
11775
11973
 
11974
+ // src/lib/utils/email.util.ts
11975
+ class EmailUtil {
11976
+ static ALLOWED_TLDS = [
11977
+ 'org', '.com', '.br', '.net', '.pt', '.io', '.ru', '.uk', '.fr',
11978
+ '.de', '.tk', '.info', '.nl', '.eu', '.it', '.au',
11979
+ ];
11980
+ static isValid(value) {
11981
+ const regex = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
11982
+ return regex.test(value) && this.ALLOWED_TLDS.some(tld => value.includes(tld));
11983
+ }
11984
+ }
11985
+
11776
11986
  // src/lib/mock/fake-data.service.ts
11777
11987
  class FakeDataService {
11778
11988
  DEFAULT_PASSWORD_OPTIONS = {
@@ -11845,5 +12055,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11845
12055
  * Generated bundle index. Do not edit.
11846
12056
  */
11847
12057
 
11848
- export { ActionDialogComponent, ActionResultDialogComponent, ActionRowComponent, AlertComponent, ArrayUtil, BREADCRUMB_PREFIX$, BadgeComponent, BadgeStackComponent, BreadcrumbComponent, BreadcrumbService, ButtonComponent, CardComponent, CheckBoxComponent, ClickCatcherDirective, CoreMaterialModule, CurrencyBrlPipe, CurrencyPreferenceService, CurrencyUtil, DateAgoPipe, DateMaskDirective, DateUtil, DefaultConsoleMessageService, DefaultMessageService, DialogService, DialogShellComponent, DirectivesModule, DocumentUtil, DynamicTabDirective, ExpansionPanelComponent, FakeDataService, FlagComponent, FooterComponent, ForDirective, GetFirstStringBeforeSpacePipe, HeaderComponent, IconComponent, InfoDetailComponent, InfoDetailDialogComponent, InputComponent, InputCurrencyComponent, InputDateComponent, InputDateRangeComponent, InputTimeComponent, IsLongerThanPipe, LineBreakAfterPeriodPipe, LineBreakAfterPipe, ListPaginationComponent, LoadingOverlayComponent, LoadingService, LowerCaseDirective, MESSAGE_SERVICE, MY_DATE_FORMATS, MemoryFormatPipe, ModuleChangeService, NavComponent, NavService, NumberUtil, ObjectUtil, PhoneBrazilPipe, PhoneMaskBrazilDirective, PhoneMaskSpainDirective, PhoneSpainPipe, PipesModule, ProfileMenuComponent, ProgressBarComponent, ProgressBarMultipleComponent, PtechAutocompleteComponent, PtechCarouselComponent, PtechColDirective, PtechConfirmationDialogComponent, PtechConfirmationService, PtechDualListboxComponent, PtechGridDirective, PtechInputFileComponent, PtechPopoverComponent, PtechTabComponent, PtechTableColumnBuilder, PtechTabsComponent, PtechTimelineComponent, PtechTimezoneClockComponent, PtechWidgetMenuComponent, PumpkinTechModule, QuantityItemsComponent, RadioGroupEntityComponent, RadioGroupEnumComponent, RedDirective, SelectEntityComponent, SelectEnumComponent, SelectQuantityItemsComponent, SlideToggleComponent, SnackbarMessageService, SpaceDropDirective, StringUtil, TableCellDirective, TableComponent, TextareaComponent, TimeDurationPipe, TitleComponent, UpperCaseDirective, UptimeFormatPipe, UuidUtil };
12058
+ export { ActionDialogComponent, ActionResultDialogComponent, ActionRowComponent, AlertComponent, ArrayUtil, BREADCRUMB_PREFIX$, BadgeComponent, BadgeStackComponent, BreadcrumbComponent, BreadcrumbService, ButtonComponent, CardComponent, CheckBoxComponent, ClickCatcherDirective, CoreMaterialModule, CurrencyBrlPipe, CurrencyPreferenceService, CurrencyUtil, DateAgoPipe, DateMaskDirective, DateUtil, DefaultConsoleMessageService, DefaultMessageService, DialogService, DialogShellComponent, DirectivesModule, DocumentUtil, DynamicTabDirective, EmailUtil, ExpansionPanelComponent, FakeDataService, FlagComponent, FooterComponent, ForDirective, GetFirstStringBeforeSpacePipe, HeaderComponent, IconComponent, InfoDetailComponent, InfoDetailDialogComponent, InputComponent, InputCurrencyComponent, InputDateComponent, InputDateRangeComponent, InputTimeComponent, IsLongerThanPipe, LineBreakAfterPeriodPipe, LineBreakAfterPipe, ListPaginationComponent, LoadingOverlayComponent, LoadingService, LowerCaseDirective, MESSAGE_SERVICE, MY_DATE_FORMATS, MemoryFormatPipe, ModuleChangeService, NavComponent, NavService, NumberUtil, ObjectUtil, PhoneBrazilPipe, PhoneMaskBrazilDirective, PhoneMaskSpainDirective, PhoneSpainPipe, PipesModule, ProfileMenuComponent, ProgressBarComponent, ProgressBarMultipleComponent, PtechAutocompleteComponent, PtechCarouselComponent, PtechColDirective, PtechConfirmationDialogComponent, PtechConfirmationService, PtechCurrencyPipe, PtechDualListboxComponent, PtechGridDirective, PtechInputFileComponent, PtechLogsComponent, PtechPopoverComponent, PtechTabComponent, PtechTableColumnBuilder, PtechTabsComponent, PtechTimelineComponent, PtechTimezoneClockComponent, PtechWidgetMenuComponent, PumpkinTechModule, QuantityItemsComponent, RadioGroupEntityComponent, RadioGroupEnumComponent, RedDirective, SelectEntityComponent, SelectEnumComponent, SelectQuantityItemsComponent, SlideToggleComponent, SnackbarMessageService, SpaceDropDirective, StringUtil, TableCellDirective, TableComponent, TextareaComponent, TimeDurationPipe, TitleComponent, UpperCaseDirective, UptimeFormatPipe, UuidUtil };
11849
12059
  //# sourceMappingURL=pumpkin-tech-pumpkin-tech-ng.mjs.map