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

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';
@@ -9974,6 +9974,7 @@ class PtechTimezoneClockComponent {
9974
9974
  showTimezone = true;
9975
9975
  showSeconds = false;
9976
9976
  time = '';
9977
+ effectiveZoneId = 'UTC';
9977
9978
  tickSubscription;
9978
9979
  constructor(cdr) {
9979
9980
  this.cdr = cdr;
@@ -9998,34 +9999,48 @@ class PtechTimezoneClockComponent {
9998
9999
  this.tickSubscription = interval(this.showSeconds ? 1000 : 30000).subscribe(() => this.tick());
9999
10000
  }
10000
10001
  tick() {
10001
- if (!this.zoneId) {
10002
- this.time = '';
10003
- this.cdr.markForCheck();
10004
- return;
10005
- }
10002
+ this.effectiveZoneId = this.resolveZoneId(this.zoneId);
10006
10003
  try {
10007
10004
  this.time = new Intl.DateTimeFormat('pt-BR', {
10008
- timeZone: this.zoneId,
10005
+ timeZone: this.effectiveZoneId,
10009
10006
  hour: '2-digit',
10010
10007
  minute: '2-digit',
10011
10008
  second: this.showSeconds ? '2-digit' : undefined,
10012
10009
  }).format(new Date());
10013
10010
  }
10014
10011
  catch {
10015
- this.time = '';
10012
+ this.effectiveZoneId = 'UTC';
10013
+ this.time = new Intl.DateTimeFormat('pt-BR', {
10014
+ timeZone: this.effectiveZoneId,
10015
+ hour: '2-digit',
10016
+ minute: '2-digit',
10017
+ second: this.showSeconds ? '2-digit' : undefined,
10018
+ }).format(new Date());
10016
10019
  }
10017
10020
  this.cdr.markForCheck();
10018
10021
  }
10022
+ resolveZoneId(zoneId) {
10023
+ const candidate = (zoneId || '').trim();
10024
+ if (!candidate) {
10025
+ return 'UTC';
10026
+ }
10027
+ try {
10028
+ new Intl.DateTimeFormat('pt-BR', { timeZone: candidate }).format(new Date());
10029
+ return candidate;
10030
+ }
10031
+ catch {
10032
+ return 'UTC';
10033
+ }
10034
+ }
10019
10035
  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
10036
  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
10037
  <span
10022
10038
  class="ptech-timezone-clock"
10023
10039
  [class.compact]="compact"
10024
- *ngIf="zoneId"
10025
- [title]="showTimezone ? zoneId : ''"
10040
+ [title]="showTimezone ? effectiveZoneId : ''"
10026
10041
  >
10027
10042
  <span class="ptech-timezone-clock-time">{{ time }}</span>
10028
- <span class="ptech-timezone-clock-zone" *ngIf="showTimezone"> — {{ zoneId }}</span>
10043
+ <span class="ptech-timezone-clock-zone" *ngIf="showTimezone"> • {{ effectiveZoneId }}</span>
10029
10044
  </span>
10030
10045
  `, 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
10046
  }
@@ -10035,11 +10050,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10035
10050
  <span
10036
10051
  class="ptech-timezone-clock"
10037
10052
  [class.compact]="compact"
10038
- *ngIf="zoneId"
10039
- [title]="showTimezone ? zoneId : ''"
10053
+ [title]="showTimezone ? effectiveZoneId : ''"
10040
10054
  >
10041
10055
  <span class="ptech-timezone-clock-time">{{ time }}</span>
10042
- <span class="ptech-timezone-clock-zone" *ngIf="showTimezone"> — {{ zoneId }}</span>
10056
+ <span class="ptech-timezone-clock-zone" *ngIf="showTimezone"> • {{ effectiveZoneId }}</span>
10043
10057
  </span>
10044
10058
  `, 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
10059
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { zoneId: [{
@@ -10052,6 +10066,231 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10052
10066
  type: Input
10053
10067
  }] } });
10054
10068
 
10069
+ class DateUtil {
10070
+ static DATE_FORMAT = 'dd/MM/yyyy';
10071
+ static TIME_HOUR_MINUTE_FORMAT = 'HH:mm';
10072
+ static TIME_HOUR_MINUTE_SEC_FORMAT = 'HH:mm:ss';
10073
+ static DATE_TIME_FORMAT = 'dd/MM/yyyy HH:mm';
10074
+ static DATE_TIME_FORMAT_SLICED = 'dd/MM/yy HH:mm';
10075
+ static DATE_TIME_FULL_FORMAT = 'dd/MM/yyyy HH:mm:ss';
10076
+ static DEFAULT_TIME_ZONE = 'UTC';
10077
+ /**
10078
+ * Aceita Date | string | undefined. Retorna string formatada ou vazio.
10079
+ */
10080
+ static format(value, format) {
10081
+ if (!value)
10082
+ return StringUtil.EMPTY;
10083
+ const dateObj = typeof value === 'string' ? new Date(value) : value;
10084
+ if (dateObj instanceof Date && !isNaN(dateObj.getTime())) {
10085
+ return formatDate(dateObj, format, 'pt-BR');
10086
+ }
10087
+ return StringUtil.EMPTY;
10088
+ }
10089
+ static formatDateToZone(utcDate, timezone, locale = 'pt-BR') {
10090
+ if (!utcDate)
10091
+ return StringUtil.EMPTY;
10092
+ const date = utcDate instanceof Date ? utcDate : new Date(utcDate);
10093
+ if (!this.isValid(date))
10094
+ return StringUtil.EMPTY;
10095
+ const zoneId = this.resolveZoneId(timezone);
10096
+ return new Intl.DateTimeFormat(locale, {
10097
+ timeZone: zoneId,
10098
+ day: '2-digit',
10099
+ month: '2-digit',
10100
+ year: 'numeric',
10101
+ hour: '2-digit',
10102
+ minute: '2-digit',
10103
+ hour12: false,
10104
+ }).format(date).replace(',', '');
10105
+ }
10106
+ static getTimeFormat(value, format) {
10107
+ if (!this.isValid(value))
10108
+ return StringUtil.EMPTY;
10109
+ const date = value instanceof Date ? value : new Date(value);
10110
+ const hour = String(date.getHours()).padStart(2, '0');
10111
+ const minute = String(date.getMinutes()).padStart(2, '0');
10112
+ const second = String(date.getSeconds()).padStart(2, '0');
10113
+ if (format === this.TIME_HOUR_MINUTE_FORMAT) {
10114
+ return `${hour}:${minute}`;
10115
+ }
10116
+ if (format === this.TIME_HOUR_MINUTE_SEC_FORMAT) {
10117
+ return `${hour}:${minute}:${second}`;
10118
+ }
10119
+ return StringUtil.EMPTY;
10120
+ }
10121
+ static getTotalDaysInMonth(month, year) {
10122
+ const date = new Date(year, month - 1, 1);
10123
+ date.setMonth(date.getMonth() + 1);
10124
+ date.setDate(date.getDate() - 1);
10125
+ return date.getDate();
10126
+ }
10127
+ static addMonthsToDate(date, monthsToAdd) {
10128
+ const resultDate = new Date(date);
10129
+ resultDate.setMonth(resultDate.getMonth() + monthsToAdd);
10130
+ return resultDate;
10131
+ }
10132
+ static addDaysToDate(days, date) {
10133
+ const result = new Date(date);
10134
+ result.setDate(result.getDate() + days);
10135
+ return result;
10136
+ }
10137
+ static isValid(value) {
10138
+ if (value === null || value === undefined)
10139
+ return false;
10140
+ const date = typeof value === 'string' ? new Date(value) : value;
10141
+ return date instanceof Date && !isNaN(date.getTime());
10142
+ }
10143
+ static isGreaterThan(initial, final) {
10144
+ const i = new Date(initial);
10145
+ const f = new Date(final);
10146
+ return this.isValid(i) && this.isValid(f) && i > f;
10147
+ }
10148
+ static isLessThan(initial, final) {
10149
+ const i = new Date(initial);
10150
+ const f = new Date(final);
10151
+ return this.isValid(i) && this.isValid(f) && i < f;
10152
+ }
10153
+ static isEqual(initial, final) {
10154
+ const i = new Date(initial);
10155
+ const f = new Date(final);
10156
+ return this.isValid(i) && this.isValid(f) && i.getTime() === f.getTime();
10157
+ }
10158
+ static isLessThanOrEqual(initial, final) {
10159
+ return this.isLessThan(initial, final) || this.isEqual(initial, final);
10160
+ }
10161
+ static isGreaterThanOrEqual(initial, final) {
10162
+ return this.isGreaterThan(initial, final) || this.isEqual(initial, final);
10163
+ }
10164
+ static isBetween(date, initial, final) {
10165
+ const d = new Date(date);
10166
+ const i = new Date(initial);
10167
+ const f = new Date(final);
10168
+ return this.isValid(d) && this.isValid(i) && this.isValid(f) && d >= i && d <= f;
10169
+ }
10170
+ static getDayOfWeek(date) {
10171
+ // getDay returns 0=Sunday
10172
+ switch (date.getDay()) {
10173
+ case 0:
10174
+ return 'SUNDAY';
10175
+ case 1:
10176
+ return 'MONDAY';
10177
+ case 2:
10178
+ return 'TUESDAY';
10179
+ case 3:
10180
+ return 'WEDNESDAY';
10181
+ case 4:
10182
+ return 'THURSDAY';
10183
+ case 5:
10184
+ return 'FRIDAY';
10185
+ case 6:
10186
+ return 'SATURDAY';
10187
+ }
10188
+ return '';
10189
+ }
10190
+ static isValidWithString(value, pattern) {
10191
+ if (!value || value.length < pattern.length)
10192
+ return false;
10193
+ return this.isValid(this.stringToDate(value, pattern));
10194
+ }
10195
+ static stringToDate(date, pattern, zoned = false) {
10196
+ const dateItems = date.replace(/[^a-zA-Z0-9]/g, '-').split('-');
10197
+ const formatItems = pattern.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-').split('-');
10198
+ const yearIndex = formatItems.indexOf('yyyy');
10199
+ const monthIndex = formatItems.indexOf('mm');
10200
+ const dayIndex = formatItems.indexOf('dd');
10201
+ const hourIndex = formatItems.indexOf('hh');
10202
+ const minutesIndex = formatItems.indexOf('ii');
10203
+ const secondsIndex = formatItems.indexOf('ss');
10204
+ const year = yearIndex > -1 ? Number(dateItems[yearIndex]) : 1970;
10205
+ const month = monthIndex > -1 ? Number(dateItems[monthIndex]) - 1 : 0;
10206
+ const day = dayIndex > -1 ? Number(dateItems[dayIndex]) : 1;
10207
+ const hour = hourIndex > -1 ? Number(dateItems[hourIndex]) : 0;
10208
+ const minute = minutesIndex > -1 ? Number(dateItems[minutesIndex]) : 0;
10209
+ const second = secondsIndex > -1 ? Number(dateItems[secondsIndex]) : 0;
10210
+ if (zoned) {
10211
+ return new Date(Date.UTC(year, month, day, hour, minute, second));
10212
+ }
10213
+ return new Date(Date.UTC(year, month, day, hour, minute, second));
10214
+ }
10215
+ static dateAndStringHourToDate(date, hour) {
10216
+ if (!this.isValid(date) || !hour)
10217
+ return new Date(NaN);
10218
+ const [hours = '0', minutes = '0'] = hour.split(':');
10219
+ const result = new Date(date);
10220
+ result.setHours(Number(hours), Number(minutes), 0, 0);
10221
+ return result;
10222
+ }
10223
+ static stringFormattedToDate(date) {
10224
+ if (!date)
10225
+ return undefined;
10226
+ const parsed = this.stringToDate(date, 'dd/mm/yyyy');
10227
+ return this.isValid(parsed) ? parsed : undefined;
10228
+ }
10229
+ static resolveZoneId(timezone) {
10230
+ const candidate = (timezone || '').trim();
10231
+ if (candidate && this.isSupportedTimeZone(candidate)) {
10232
+ return candidate;
10233
+ }
10234
+ return this.DEFAULT_TIME_ZONE;
10235
+ }
10236
+ static isSupportedTimeZone(timezone) {
10237
+ try {
10238
+ new Intl.DateTimeFormat('en-US', { timeZone: timezone }).format(new Date());
10239
+ return true;
10240
+ }
10241
+ catch {
10242
+ return false;
10243
+ }
10244
+ }
10245
+ }
10246
+
10247
+ class PtechLogsComponent {
10248
+ model;
10249
+ updatedLabel = 'Atualizado em';
10250
+ atLabel = 'às';
10251
+ systemLabel = 'por sistema';
10252
+ dateFormat = 'dd/MM/yyyy';
10253
+ timeFormat = 'HH:mm';
10254
+ message = '';
10255
+ ngOnChanges(_) {
10256
+ this.message = this.buildMessage();
10257
+ }
10258
+ buildMessage() {
10259
+ if (!this.model) {
10260
+ return '';
10261
+ }
10262
+ const date = this.model.lastUpdateDate || this.model.creationDate;
10263
+ if (!date) {
10264
+ return '';
10265
+ }
10266
+ const formattedDate = DateUtil.format(date, this.dateFormat);
10267
+ const formattedTime = DateUtil.format(date, this.timeFormat);
10268
+ if (!formattedDate || !formattedTime) {
10269
+ return '';
10270
+ }
10271
+ const base = `${this.updatedLabel} ${formattedDate} ${this.atLabel} ${formattedTime}`;
10272
+ return this.model.changedBy ? base : `${base} - ${this.systemLabel}`;
10273
+ }
10274
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechLogsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10275
+ 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 });
10276
+ }
10277
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechLogsComponent, decorators: [{
10278
+ type: Component,
10279
+ 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"] }]
10280
+ }], propDecorators: { model: [{
10281
+ type: Input
10282
+ }], updatedLabel: [{
10283
+ type: Input
10284
+ }], atLabel: [{
10285
+ type: Input
10286
+ }], systemLabel: [{
10287
+ type: Input
10288
+ }], dateFormat: [{
10289
+ type: Input
10290
+ }], timeFormat: [{
10291
+ type: Input
10292
+ }] } });
10293
+
10055
10294
  class SnackbarMessageService {
10056
10295
  snackBar;
10057
10296
  constructor(snackBar) {
@@ -10170,7 +10409,8 @@ class PumpkinTechModule {
10170
10409
  PtechWidgetMenuComponent,
10171
10410
  PtechCarouselComponent,
10172
10411
  PtechTimelineComponent,
10173
- PtechTimezoneClockComponent], exports: [
10412
+ PtechTimezoneClockComponent,
10413
+ PtechLogsComponent], exports: [
10174
10414
  // reexporta tudo junto
10175
10415
  InputComponent,
10176
10416
  TextareaComponent,
@@ -10220,6 +10460,7 @@ class PumpkinTechModule {
10220
10460
  PtechCarouselComponent,
10221
10461
  PtechTimelineComponent,
10222
10462
  PtechTimezoneClockComponent,
10463
+ PtechLogsComponent,
10223
10464
  CoreMaterialModule] });
10224
10465
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PumpkinTechModule, providers: [
10225
10466
  {
@@ -10274,7 +10515,8 @@ class PumpkinTechModule {
10274
10515
  PtechWidgetMenuComponent,
10275
10516
  PtechCarouselComponent,
10276
10517
  PtechTimelineComponent,
10277
- PtechTimezoneClockComponent, CoreMaterialModule] });
10518
+ PtechTimezoneClockComponent,
10519
+ PtechLogsComponent, CoreMaterialModule] });
10278
10520
  }
10279
10521
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PumpkinTechModule, decorators: [{
10280
10522
  type: NgModule,
@@ -10330,7 +10572,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10330
10572
  PtechWidgetMenuComponent,
10331
10573
  PtechCarouselComponent,
10332
10574
  PtechTimelineComponent,
10333
- PtechTimezoneClockComponent
10575
+ PtechTimezoneClockComponent,
10576
+ PtechLogsComponent
10334
10577
  ],
10335
10578
  exports: [
10336
10579
  // reexporta tudo junto
@@ -10382,6 +10625,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10382
10625
  PtechCarouselComponent,
10383
10626
  PtechTimelineComponent,
10384
10627
  PtechTimezoneClockComponent,
10628
+ PtechLogsComponent,
10385
10629
  CoreMaterialModule,
10386
10630
  ],
10387
10631
  providers: [
@@ -10878,6 +11122,125 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
10878
11122
  }]
10879
11123
  }] });
10880
11124
 
11125
+ // currency-preference.service.ts
11126
+ const CURRENCY_KEY = 'currency_preference';
11127
+ const DEFAULT_CURRENCY = 'EUR';
11128
+ const CURRENCY_MAP = {
11129
+ EUR: {
11130
+ symbol: '€',
11131
+ thousandSeparator: '.',
11132
+ decimalMarker: ',',
11133
+ placeholder: '0,00',
11134
+ locale: 'de-DE', // uso de padrão europeu para vírgula decimal
11135
+ },
11136
+ USD: {
11137
+ symbol: '$',
11138
+ thousandSeparator: ',',
11139
+ decimalMarker: '.',
11140
+ placeholder: '0.00',
11141
+ locale: 'en-US',
11142
+ },
11143
+ BRL: {
11144
+ symbol: 'R$',
11145
+ thousandSeparator: '.',
11146
+ decimalMarker: ',',
11147
+ placeholder: '0,00',
11148
+ locale: 'pt-BR',
11149
+ },
11150
+ };
11151
+ class CurrencyPreferenceService {
11152
+ _currency = DEFAULT_CURRENCY;
11153
+ _subject = new BehaviorSubject(DEFAULT_CURRENCY);
11154
+ currency$ = this._subject.asObservable();
11155
+ constructor() {
11156
+ this.loadInitialCurrency();
11157
+ }
11158
+ loadInitialCurrency() {
11159
+ const stored = localStorage.getItem(CURRENCY_KEY);
11160
+ if (stored && this.isSupported(stored)) {
11161
+ this._setCurrencyInternal(stored);
11162
+ }
11163
+ else {
11164
+ // opcional: inferir da locale do navegador
11165
+ // const inferred = navigator.language.startsWith('pt') ? 'BRL' : 'EUR';
11166
+ this._setCurrencyInternal(this._currency);
11167
+ }
11168
+ }
11169
+ isSupported(code) {
11170
+ return code in CURRENCY_MAP;
11171
+ }
11172
+ _setCurrencyInternal(newCurrency) {
11173
+ this._currency = newCurrency;
11174
+ this._subject.next(newCurrency);
11175
+ }
11176
+ getCurrency() {
11177
+ return this._currency;
11178
+ }
11179
+ setCurrency(newCurrency) {
11180
+ if (!this.isSupported(newCurrency)) {
11181
+ console.warn(`Currency ${newCurrency} not supported. Falling back to default.`);
11182
+ newCurrency = DEFAULT_CURRENCY;
11183
+ }
11184
+ this._setCurrencyInternal(newCurrency);
11185
+ localStorage.setItem(CURRENCY_KEY, newCurrency);
11186
+ }
11187
+ getCurrencySymbol() {
11188
+ return CURRENCY_MAP[this._currency].symbol;
11189
+ }
11190
+ getThousandSeparator() {
11191
+ return CURRENCY_MAP[this._currency].thousandSeparator;
11192
+ }
11193
+ getDecimalMarker() {
11194
+ return CURRENCY_MAP[this._currency].decimalMarker;
11195
+ }
11196
+ getPlaceholder() {
11197
+ return CURRENCY_MAP[this._currency].placeholder;
11198
+ }
11199
+ formatAmount(value, options) {
11200
+ const meta = CURRENCY_MAP[this._currency];
11201
+ const formatter = new Intl.NumberFormat(meta.locale, {
11202
+ style: 'currency',
11203
+ currency: this._currency === 'BRL' ? 'BRL' : this._currency, // map if codes diferem
11204
+ minimumFractionDigits: options?.minimumFractionDigits ?? 2,
11205
+ maximumFractionDigits: options?.maximumFractionDigits ?? 2,
11206
+ currencyDisplay: options?.useSymbol === false ? 'code' : 'symbol',
11207
+ });
11208
+ return formatter.format(value);
11209
+ }
11210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11211
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, providedIn: 'root' });
11212
+ }
11213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CurrencyPreferenceService, decorators: [{
11214
+ type: Injectable,
11215
+ args: [{
11216
+ providedIn: 'root',
11217
+ }]
11218
+ }], ctorParameters: () => [] });
11219
+
11220
+ class PtechCurrencyPipe {
11221
+ currencyPreferenceService;
11222
+ constructor(currencyPreferenceService) {
11223
+ this.currencyPreferenceService = currencyPreferenceService;
11224
+ }
11225
+ transform(value, minimumFractionDigits = 2, maximumFractionDigits = 2, useSymbol = true) {
11226
+ return this.currencyPreferenceService.formatAmount(value ?? 0, {
11227
+ minimumFractionDigits,
11228
+ maximumFractionDigits,
11229
+ useSymbol,
11230
+ });
11231
+ }
11232
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechCurrencyPipe, deps: [{ token: CurrencyPreferenceService }], target: i0.ɵɵFactoryTarget.Pipe });
11233
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: PtechCurrencyPipe, isStandalone: true, name: "ptechCurrency", pure: false });
11234
+ }
11235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechCurrencyPipe, decorators: [{
11236
+ type: Pipe,
11237
+ args: [{
11238
+ name: 'ptechCurrency',
11239
+ standalone: true,
11240
+ pure: false,
11241
+ }]
11242
+ }], ctorParameters: () => [{ type: CurrencyPreferenceService }] });
11243
+
10881
11244
  class DateAgoPipe {
10882
11245
  intervals = {
10883
11246
  ano: 31536000,
@@ -11212,6 +11575,7 @@ class PipesModule {
11212
11575
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
11213
11576
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: PipesModule, imports: [CommonModule,
11214
11577
  CurrencyBrlPipe,
11578
+ PtechCurrencyPipe,
11215
11579
  DateAgoPipe,
11216
11580
  GetFirstStringBeforeSpacePipe,
11217
11581
  LineBreakAfterPeriodPipe,
@@ -11222,6 +11586,7 @@ class PipesModule {
11222
11586
  UptimeFormatPipe,
11223
11587
  TimeDurationPipe,
11224
11588
  IsLongerThanPipe], exports: [CurrencyBrlPipe,
11589
+ PtechCurrencyPipe,
11225
11590
  DateAgoPipe,
11226
11591
  GetFirstStringBeforeSpacePipe,
11227
11592
  LineBreakAfterPeriodPipe,
@@ -11240,6 +11605,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11240
11605
  imports: [
11241
11606
  CommonModule,
11242
11607
  CurrencyBrlPipe,
11608
+ PtechCurrencyPipe,
11243
11609
  DateAgoPipe,
11244
11610
  GetFirstStringBeforeSpacePipe,
11245
11611
  LineBreakAfterPeriodPipe,
@@ -11253,6 +11619,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11253
11619
  ],
11254
11620
  exports: [
11255
11621
  CurrencyBrlPipe,
11622
+ PtechCurrencyPipe,
11256
11623
  DateAgoPipe,
11257
11624
  GetFirstStringBeforeSpacePipe,
11258
11625
  LineBreakAfterPeriodPipe,
@@ -11392,101 +11759,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11392
11759
  }]
11393
11760
  }] });
11394
11761
 
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
11762
  /**
11491
11763
  * Se o app consumidor quiser inserir dinamicamente
11492
11764
  * o crumb de “módulo” (ou qualquer outro prefixo),
@@ -11572,84 +11844,6 @@ class NumberUtil {
11572
11844
  }
11573
11845
  }
11574
11846
 
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
11847
  // src/lib/utils/currency.util.ts
11654
11848
  class CurrencyUtil {
11655
11849
  /**
@@ -11773,6 +11967,18 @@ class UuidUtil {
11773
11967
  }
11774
11968
  }
11775
11969
 
11970
+ // src/lib/utils/email.util.ts
11971
+ class EmailUtil {
11972
+ static ALLOWED_TLDS = [
11973
+ 'org', '.com', '.br', '.net', '.pt', '.io', '.ru', '.uk', '.fr',
11974
+ '.de', '.tk', '.info', '.nl', '.eu', '.it', '.au',
11975
+ ];
11976
+ static isValid(value) {
11977
+ const regex = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
11978
+ return regex.test(value) && this.ALLOWED_TLDS.some(tld => value.includes(tld));
11979
+ }
11980
+ }
11981
+
11776
11982
  // src/lib/mock/fake-data.service.ts
11777
11983
  class FakeDataService {
11778
11984
  DEFAULT_PASSWORD_OPTIONS = {
@@ -11845,5 +12051,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11845
12051
  * Generated bundle index. Do not edit.
11846
12052
  */
11847
12053
 
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 };
12054
+ 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
12055
  //# sourceMappingURL=pumpkin-tech-pumpkin-tech-ng.mjs.map