@senior-agronegocio/angular-components 0.0.9863 → 0.0.9864

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 (59) hide show
  1. package/bundles/senior-agronegocio-angular-components.umd.js +330 -25
  2. package/bundles/senior-agronegocio-angular-components.umd.js.map +1 -1
  3. package/bundles/senior-agronegocio-angular-components.umd.min.js +2 -2
  4. package/bundles/senior-agronegocio-angular-components.umd.min.js.map +1 -1
  5. package/common/agro-object-stringifier.class.d.ts +16 -0
  6. package/common/agro-regex.constant.d.ts +3 -0
  7. package/common/agro-string-utils.class.d.ts +8 -0
  8. package/esm2015/common/agro-object-stringifier.class.js +31 -0
  9. package/esm2015/common/agro-platform-utils.class.js +8 -7
  10. package/esm2015/common/agro-regex.constant.js +5 -2
  11. package/esm2015/common/agro-string-utils.class.js +89 -11
  12. package/esm2015/pipe/cnpj-cpf/cnpj-cpf.pipe.js +28 -0
  13. package/esm2015/pipe/cnpj-cpf/cnpj-cpf.pipe.module.js +15 -0
  14. package/esm2015/pipe/cnpj-cpf/index.js +3 -0
  15. package/esm2015/pipe/index.js +4 -1
  16. package/esm2015/pipe/stringifier/index.js +3 -0
  17. package/esm2015/pipe/stringifier/stringifier.pipe.js +13 -0
  18. package/esm2015/pipe/stringifier/stringifier.pipe.module.js +15 -0
  19. package/esm2015/pipe/telephone/index.js +3 -0
  20. package/esm2015/pipe/telephone/telephone.pipe.js +91 -0
  21. package/esm2015/pipe/telephone/telephone.pipe.module.js +15 -0
  22. package/esm2015/public-api.js +3 -3
  23. package/esm2015/senior-agronegocio-angular-components.js +3 -2
  24. package/esm2015/services/lib-translation.service.js +2 -2
  25. package/esm5/common/agro-object-stringifier.class.js +35 -0
  26. package/esm5/common/agro-platform-utils.class.js +8 -7
  27. package/esm5/common/agro-regex.constant.js +5 -2
  28. package/esm5/common/agro-string-utils.class.js +106 -17
  29. package/esm5/pipe/cnpj-cpf/cnpj-cpf.pipe.js +35 -0
  30. package/esm5/pipe/cnpj-cpf/cnpj-cpf.pipe.module.js +18 -0
  31. package/esm5/pipe/cnpj-cpf/index.js +3 -0
  32. package/esm5/pipe/index.js +4 -1
  33. package/esm5/pipe/stringifier/index.js +3 -0
  34. package/esm5/pipe/stringifier/stringifier.pipe.js +16 -0
  35. package/esm5/pipe/stringifier/stringifier.pipe.module.js +18 -0
  36. package/esm5/pipe/telephone/index.js +3 -0
  37. package/esm5/pipe/telephone/telephone.pipe.js +95 -0
  38. package/esm5/pipe/telephone/telephone.pipe.module.js +18 -0
  39. package/esm5/public-api.js +3 -3
  40. package/esm5/senior-agronegocio-angular-components.js +3 -2
  41. package/esm5/services/lib-translation.service.js +2 -2
  42. package/fesm2015/senior-agronegocio-angular-components.js +280 -19
  43. package/fesm2015/senior-agronegocio-angular-components.js.map +1 -1
  44. package/fesm5/senior-agronegocio-angular-components.js +323 -25
  45. package/fesm5/senior-agronegocio-angular-components.js.map +1 -1
  46. package/package.json +7 -55
  47. package/pipe/cnpj-cpf/cnpj-cpf.pipe.d.ts +4 -0
  48. package/pipe/cnpj-cpf/cnpj-cpf.pipe.module.d.ts +2 -0
  49. package/pipe/cnpj-cpf/index.d.ts +2 -0
  50. package/pipe/index.d.ts +3 -0
  51. package/pipe/stringifier/index.d.ts +2 -0
  52. package/pipe/stringifier/stringifier.pipe.d.ts +9 -0
  53. package/pipe/stringifier/stringifier.pipe.module.d.ts +2 -0
  54. package/pipe/telephone/index.d.ts +2 -0
  55. package/pipe/telephone/telephone.pipe.d.ts +21 -0
  56. package/pipe/telephone/telephone.pipe.module.d.ts +2 -0
  57. package/public-api.d.ts +2 -2
  58. package/senior-agronegocio-angular-components.d.ts +2 -1
  59. package/senior-agronegocio-angular-components.metadata.json +1 -1
@@ -360,7 +360,10 @@
360
360
  * Validação de Placa de Veículo Antiga
361
361
  * Formato: AAA-0000
362
362
  */
363
- isOldLicensePlate: /^[A-Z]{3}[0-9]{4}$/
363
+ isOldLicensePlate: /^[A-Z]{3}\d{4}$/,
364
+ isISODate: /^\d{4}-\d{2}-\d{2}$/,
365
+ isISOTime: /^\d{2}:\d{2}:\d{2}$/,
366
+ isISODateTime: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/,
364
367
  };
365
368
 
366
369
 
@@ -2290,13 +2293,19 @@
2290
2293
  */
2291
2294
  AgroStringUtils.isEmpty = function (str) {
2292
2295
  var _a;
2293
- return !str || ((_a = str.trim()) === null || _a === void 0 ? void 0 : _a.length) === exports.AGRO_NUMBERS.ZERO;
2296
+ if (str && AgroStringUtils.isString(str)) {
2297
+ return ((_a = str === null || str === void 0 ? void 0 : str.trim()) === null || _a === void 0 ? void 0 : _a.length) === exports.AGRO_NUMBERS.ZERO;
2298
+ }
2299
+ return true;
2294
2300
  };
2295
2301
  /**
2296
2302
  * Verifica se a string não está vazia.
2297
2303
  */
2298
2304
  AgroStringUtils.isNotEmpty = function (str) {
2299
- return !AgroStringUtils.isEmpty(str);
2305
+ if (str && AgroStringUtils.isString(str)) {
2306
+ return !AgroStringUtils.isEmpty(str);
2307
+ }
2308
+ return false;
2300
2309
  };
2301
2310
  /** Verifica se a string é nula, indefinida ou contém apenas espaços em branco */
2302
2311
  AgroStringUtils.isBlank = function (str) {
@@ -2351,7 +2360,7 @@
2351
2360
  return AGRO_REGEX.isUUID.test(str);
2352
2361
  };
2353
2362
  AgroStringUtils.isNumber = function (str) {
2354
- return AGRO_REGEX.isNumber.test(str);
2363
+ return [AGRO_REGEX.isNumber.test(str), AGRO_REGEX.isDecimal.test(str)].includes(true);
2355
2364
  };
2356
2365
  AgroStringUtils.validateCPF = function (cpf) {
2357
2366
  cpf = cpf.replace(/\D/g, "");
@@ -2368,7 +2377,7 @@
2368
2377
  };
2369
2378
  var digit1 = calcVerifier(cpf, exports.AGRO_NUMBERS.NINE);
2370
2379
  var digit2 = calcVerifier(cpf, exports.AGRO_NUMBERS.TEN);
2371
- return digit1 === parseInt(cpf[exports.AGRO_NUMBERS.NINE], exports.AGRO_NUMBERS.TEN) && digit2 === parseInt(cpf[exports.AGRO_NUMBERS.TEN], exports.AGRO_NUMBERS.TEN);
2380
+ return (digit1 === parseInt(cpf[exports.AGRO_NUMBERS.NINE], exports.AGRO_NUMBERS.TEN) && digit2 === parseInt(cpf[exports.AGRO_NUMBERS.TEN], exports.AGRO_NUMBERS.TEN));
2372
2381
  };
2373
2382
  /**
2374
2383
  * Detecta automaticamente se é CNPJ antigo ou novo formato.
@@ -2411,7 +2420,8 @@
2411
2420
  }
2412
2421
  resto = soma % exports.AGRO_NUMBERS.ELEVEN;
2413
2422
  var digito2 = resto < exports.AGRO_NUMBERS.TWO ? exports.AGRO_NUMBERS.ZERO : exports.AGRO_NUMBERS.ELEVEN - resto;
2414
- return parseInt(cnpj.charAt(exports.AGRO_NUMBERS.TWELVE), exports.AGRO_NUMBERS.TEN) === digito1 && parseInt(cnpj.charAt(exports.AGRO_NUMBERS.THIRTEEN), exports.AGRO_NUMBERS.TEN) === digito2;
2423
+ return (parseInt(cnpj.charAt(exports.AGRO_NUMBERS.TWELVE), exports.AGRO_NUMBERS.TEN) === digito1 &&
2424
+ parseInt(cnpj.charAt(exports.AGRO_NUMBERS.THIRTEEN), exports.AGRO_NUMBERS.TEN) === digito2);
2415
2425
  };
2416
2426
  /**
2417
2427
  * Valida o CNPJ em formato alfanumérico (padrão 2026)
@@ -2507,20 +2517,93 @@
2507
2517
  var matches = str.match(regex);
2508
2518
  return matches ? matches.length : exports.AGRO_NUMBERS.ZERO;
2509
2519
  };
2520
+ /**
2521
+ * Remove uma máscara simples da string fornecida.O padrão de máscaras é definido pelo enum AgroStringMasks ou
2522
+ * pode ser uma string personalizada onde '9' representa um dígito a ser mantido da string.
2523
+ */
2524
+ AgroStringUtils.removeMask = function (value, mask) {
2525
+ var e_1, _a;
2526
+ if (!value || !mask) {
2527
+ return value;
2528
+ }
2529
+ var valueChars = value.toString().split("");
2530
+ var maskChars = mask.split("");
2531
+ var unmaskedValue = "";
2532
+ var j = 0;
2533
+ var isDigit = function (c) { return /\d/.test(c); };
2534
+ var isAlpha = function (c) { return /[A-Za-z]/.test(c); };
2535
+ var isAlnum = function (c) { return /[A-Za-z0-9]/.test(c); };
2536
+ var extractNext = function (testFn) {
2537
+ var k = j;
2538
+ while (k < valueChars.length && !testFn(valueChars[k])) {
2539
+ k++;
2540
+ }
2541
+ if (k < valueChars.length) {
2542
+ var found = valueChars[k];
2543
+ j = k + 1;
2544
+ return found;
2545
+ }
2546
+ var fallback = valueChars[j];
2547
+ j++;
2548
+ return fallback;
2549
+ };
2550
+ var processMaskChar = function (maskChar) {
2551
+ var _a, _b;
2552
+ if (j >= valueChars.length) {
2553
+ return;
2554
+ }
2555
+ var current = valueChars[j];
2556
+ switch (maskChar) {
2557
+ case "9":
2558
+ unmaskedValue += (_a = extractNext(isDigit)) !== null && _a !== void 0 ? _a : "";
2559
+ break;
2560
+ case "A":
2561
+ unmaskedValue += (_b = extractNext(isAlpha)) !== null && _b !== void 0 ? _b : "";
2562
+ break;
2563
+ default:
2564
+ handleSeparator(maskChar, current);
2565
+ break;
2566
+ }
2567
+ };
2568
+ var handleSeparator = function (maskChar, current) {
2569
+ if (current === maskChar) {
2570
+ j++; // separador presente no valor
2571
+ }
2572
+ if (isAlnum(current)) {
2573
+ unmaskedValue += current;
2574
+ j++;
2575
+ }
2576
+ // se for pontuação diferente, apenas ignora (não consome j)
2577
+ };
2578
+ try {
2579
+ for (var maskChars_1 = __values(maskChars), maskChars_1_1 = maskChars_1.next(); !maskChars_1_1.done; maskChars_1_1 = maskChars_1.next()) {
2580
+ var maskChar = maskChars_1_1.value;
2581
+ processMaskChar(maskChar);
2582
+ }
2583
+ }
2584
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2585
+ finally {
2586
+ try {
2587
+ if (maskChars_1_1 && !maskChars_1_1.done && (_a = maskChars_1.return)) _a.call(maskChars_1);
2588
+ }
2589
+ finally { if (e_1) throw e_1.error; }
2590
+ }
2591
+ return unmaskedValue;
2592
+ };
2510
2593
  /**
2511
2594
  * Aplica uma máscara simples à string fornecida.O padrão de máscaras é definido pelo enum AgroStringMasks ou
2512
2595
  * pode ser uma string personalizada onde '9' representa um dígito a ser substituído pelo caractere correspondente
2513
2596
  * da string.
2514
2597
  */
2515
2598
  AgroStringUtils.applyMask = function (value, mask) {
2516
- var e_1, _a;
2517
- var valueChars = value.toString().split("");
2599
+ var e_2, _a;
2600
+ var valueChars = AgroStringUtils.removeMask(value, mask).toString().split("");
2518
2601
  var maskChars = mask.split("");
2519
2602
  var maskedValue = "";
2520
2603
  var j = exports.AGRO_NUMBERS.ZERO;
2521
2604
  try {
2522
- for (var maskChars_1 = __values(maskChars), maskChars_1_1 = maskChars_1.next(); !maskChars_1_1.done; maskChars_1_1 = maskChars_1.next()) {
2523
- var maskChar = maskChars_1_1.value;
2605
+ for (var maskChars_2 = __values(maskChars), maskChars_2_1 = maskChars_2.next(); !maskChars_2_1.done; maskChars_2_1 = maskChars_2.next()) {
2606
+ var maskChar = maskChars_2_1.value;
2524
2607
  if (j >= valueChars.length) {
2525
2608
  break;
2526
2609
  }
@@ -2533,12 +2616,12 @@
2533
2616
  }
2534
2617
  }
2535
2618
  }
2536
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2619
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2537
2620
  finally {
2538
2621
  try {
2539
- if (maskChars_1_1 && !maskChars_1_1.done && (_a = maskChars_1.return)) _a.call(maskChars_1);
2622
+ if (maskChars_2_1 && !maskChars_2_1.done && (_a = maskChars_2.return)) _a.call(maskChars_2);
2540
2623
  }
2541
- finally { if (e_1) throw e_1.error; }
2624
+ finally { if (e_2) throw e_2.error; }
2542
2625
  }
2543
2626
  return maskedValue;
2544
2627
  };
@@ -2548,6 +2631,15 @@
2548
2631
  AgroStringUtils.isInvalid = function (str) {
2549
2632
  return !AgroStringUtils.isValid(str);
2550
2633
  };
2634
+ AgroStringUtils.isISODate = function (value) {
2635
+ return AGRO_REGEX.isISODate.test(value);
2636
+ };
2637
+ AgroStringUtils.isISOTime = function (value) {
2638
+ return AGRO_REGEX.isISOTime.test(value);
2639
+ };
2640
+ AgroStringUtils.isISODatetime = function (value) {
2641
+ return AGRO_REGEX.isISODateTime.test(value);
2642
+ };
2551
2643
  AgroStringUtils.CNPJ_TRADICIONAL_PESOS_1 = [
2552
2644
  exports.AGRO_NUMBERS.FIVE,
2553
2645
  exports.AGRO_NUMBERS.FOUR,
@@ -2560,7 +2652,7 @@
2560
2652
  exports.AGRO_NUMBERS.FIVE,
2561
2653
  exports.AGRO_NUMBERS.FOUR,
2562
2654
  exports.AGRO_NUMBERS.THREE,
2563
- exports.AGRO_NUMBERS.TWO
2655
+ exports.AGRO_NUMBERS.TWO,
2564
2656
  ];
2565
2657
  AgroStringUtils.CNPJ_TRADICIONAL_PESOS_2 = [
2566
2658
  exports.AGRO_NUMBERS.SIX,
@@ -2575,7 +2667,7 @@
2575
2667
  exports.AGRO_NUMBERS.FIVE,
2576
2668
  exports.AGRO_NUMBERS.FOUR,
2577
2669
  exports.AGRO_NUMBERS.THREE,
2578
- exports.AGRO_NUMBERS.TWO
2670
+ exports.AGRO_NUMBERS.TWO,
2579
2671
  ];
2580
2672
  // Pesos utilizados para cálculo de dígitos verificadores do CNPJ alfanumérico (2026)
2581
2673
  AgroStringUtils.CNPJ_ALFANUMERICO_PESOS_1 = [
@@ -2590,7 +2682,7 @@
2590
2682
  exports.AGRO_NUMBERS.FIVE,
2591
2683
  exports.AGRO_NUMBERS.FOUR,
2592
2684
  exports.AGRO_NUMBERS.THREE,
2593
- exports.AGRO_NUMBERS.TWO
2685
+ exports.AGRO_NUMBERS.TWO,
2594
2686
  ];
2595
2687
  AgroStringUtils.CNPJ_ALFANUMERICO_PESOS_2 = [
2596
2688
  exports.AGRO_NUMBERS.SIX,
@@ -2605,7 +2697,7 @@
2605
2697
  exports.AGRO_NUMBERS.FIVE,
2606
2698
  exports.AGRO_NUMBERS.FOUR,
2607
2699
  exports.AGRO_NUMBERS.THREE,
2608
- exports.AGRO_NUMBERS.TWO
2700
+ exports.AGRO_NUMBERS.TWO,
2609
2701
  ];
2610
2702
  return AgroStringUtils;
2611
2703
  }());
@@ -2623,7 +2715,7 @@
2623
2715
  * @returns
2624
2716
  */
2625
2717
  AgroPlatformUtils.getCurrentTenant = function () {
2626
- var tenant = AgroPlatformUtils.getTokenField('tenantName');
2718
+ var tenant = AgroPlatformUtils.getTokenField("tenantName");
2627
2719
  if (tenant) {
2628
2720
  return tenant;
2629
2721
  }
@@ -2635,17 +2727,18 @@
2635
2727
  * @returns
2636
2728
  */
2637
2729
  AgroPlatformUtils.getCurrentTenantLocale = function () {
2638
- var locale = AgroPlatformUtils.getTokenField('locale');
2730
+ var locale = AgroPlatformUtils.getTokenField("locale");
2639
2731
  if (locale) {
2640
2732
  return locale;
2641
2733
  }
2642
- throw new Error("Cookie: \"" + COOKIE_TOKEN + "\" n\u00E3o encontrado.");
2734
+ throw new Error("'locale' n\u00E3o encontrado para o tenant atual.");
2643
2735
  };
2644
2736
  /**
2645
2737
  * @deprecated Use getCurrentTenantLocale()
2646
2738
  * Mantido por compatibilidade retroativa.
2647
2739
  */
2648
2740
  AgroPlatformUtils.getCurrenTenantLocale = function () {
2741
+ // legacy typo retained
2649
2742
  return AgroPlatformUtils.getCurrentTenantLocale();
2650
2743
  };
2651
2744
  /**
@@ -2654,7 +2747,7 @@
2654
2747
  * @returns string || null
2655
2748
  */
2656
2749
  AgroPlatformUtils.getCurrentUserName = function () {
2657
- var name = AgroPlatformUtils.getTokenField('fullName');
2750
+ var name = AgroPlatformUtils.getTokenField("fullName");
2658
2751
  return name || null;
2659
2752
  };
2660
2753
  /**
@@ -2663,7 +2756,7 @@
2663
2756
  * @returns string
2664
2757
  */
2665
2758
  AgroPlatformUtils.getCurrentUserEmail = function () {
2666
- var email = AgroPlatformUtils.getTokenField('email');
2759
+ var email = AgroPlatformUtils.getTokenField("email");
2667
2760
  if (!email) {
2668
2761
  console.info("Cookie: \"" + COOKIE_TOKEN + "\" n\u00E3o encontrado.");
2669
2762
  }
@@ -2698,7 +2791,7 @@
2698
2791
  * Caso contrário, retorna uma instância de Error
2699
2792
  */
2700
2793
  AgroPlatformUtils.getCurrentAccessToken = function () {
2701
- var token = AgroPlatformUtils.getTokenField('access_token');
2794
+ var token = AgroPlatformUtils.getTokenField("access_token");
2702
2795
  if (!token) {
2703
2796
  console.info("Cookie: \"" + COOKIE_TOKEN + "\" n\u00E3o encontrado.");
2704
2797
  }
@@ -4554,7 +4647,7 @@
4554
4647
  this.setLang(this.getLangOfUser());
4555
4648
  }
4556
4649
  LibTranslationService.prototype.getLangOfUser = function () {
4557
- return AgroPlatformUtils.getCurrenTenantLocale() || "pt-BR";
4650
+ return AgroPlatformUtils.getCurrentTenantLocale() || "pt-BR";
4558
4651
  };
4559
4652
  LibTranslationService.prototype.setLang = function (lang) {
4560
4653
  this.currentTranslation = this.availableTranslations[lang] || {};
@@ -7337,6 +7430,211 @@
7337
7430
  return FinancialTitleTableModule;
7338
7431
  }());
7339
7432
 
7433
+ var CnpjCpfPipe = /** @class */ (function () {
7434
+ function CnpjCpfPipe() {
7435
+ }
7436
+ CnpjCpfPipe.prototype.transform = function (value) {
7437
+ var args = [];
7438
+ for (var _i = 1; _i < arguments.length; _i++) {
7439
+ args[_i - 1] = arguments[_i];
7440
+ }
7441
+ if (typeof value !== "string" && typeof value === "number") {
7442
+ value = value === null || value === void 0 ? void 0 : value.toString();
7443
+ }
7444
+ if (typeof value !== "string") {
7445
+ return value;
7446
+ }
7447
+ if (AgroStringUtils.validateCNPJ(value)) {
7448
+ return AgroStringUtils.applyMask(value, exports.AgroStringMasks.CNPJ);
7449
+ }
7450
+ if (AgroStringUtils.validateCPF(value)) {
7451
+ return AgroStringUtils.applyMask(value, exports.AgroStringMasks.CPF);
7452
+ }
7453
+ return value;
7454
+ };
7455
+ CnpjCpfPipe = __decorate([
7456
+ core.Pipe({
7457
+ name: "cnpjCpf",
7458
+ })
7459
+ ], CnpjCpfPipe);
7460
+ return CnpjCpfPipe;
7461
+ }());
7462
+
7463
+ var CnpjCpfPipeModule = /** @class */ (function () {
7464
+ function CnpjCpfPipeModule() {
7465
+ }
7466
+ CnpjCpfPipeModule = __decorate([
7467
+ core.NgModule({
7468
+ declarations: [CnpjCpfPipe],
7469
+ imports: [common.CommonModule],
7470
+ exports: [CnpjCpfPipe],
7471
+ })
7472
+ ], CnpjCpfPipeModule);
7473
+ return CnpjCpfPipeModule;
7474
+ }());
7475
+
7476
+ var AgroObjectStringifier = /** @class */ (function () {
7477
+ function AgroObjectStringifier() {
7478
+ }
7479
+ /**
7480
+ * Formata um objeto concatenando valores segundo as chaves e pipes informados.
7481
+ *
7482
+ * @param separator Separador entre os valores (ex: "-")
7483
+ * @param fields Campos a extrair. Podem conter subpropriedades ("propriedade.subPropriedade") e pipes ("propriedade|nomeDaPipe:arg1:arg2")
7484
+ * @param obj Objeto origem
7485
+ */
7486
+ AgroObjectStringifier.formatObject = function (separator, fields, obj, usePipes) {
7487
+ function mapField(field) {
7488
+ var value = AgroObjectStringifier.resolvePath(obj, field);
7489
+ if (usePipes === null || usePipes === void 0 ? void 0 : usePipes.hasOwnProperty(field)) {
7490
+ return usePipes[field].transform(value);
7491
+ }
7492
+ return value !== null && value !== void 0 ? value : "";
7493
+ }
7494
+ function filterValid(v) {
7495
+ return typeof v === "number" || AgroStringUtils.isValid(v);
7496
+ }
7497
+ return fields.map(mapField).filter(filterValid).join(" " + separator + " ");
7498
+ };
7499
+ /** Resolve um caminho tipo "empresa.cargo" dentro de um objeto */
7500
+ AgroObjectStringifier.resolvePath = function (obj, path) {
7501
+ function reducer(acc, key) {
7502
+ return acc === null || acc === void 0 ? void 0 : acc[key];
7503
+ }
7504
+ return path.split(".").reduce(reducer, obj);
7505
+ };
7506
+ return AgroObjectStringifier;
7507
+ }());
7508
+
7509
+ var StringifierPipe = /** @class */ (function () {
7510
+ function StringifierPipe() {
7511
+ }
7512
+ StringifierPipe.prototype.transform = function (value, separator, paths, pipes) {
7513
+ return AgroObjectStringifier.formatObject(separator, paths, value, pipes);
7514
+ };
7515
+ StringifierPipe = __decorate([
7516
+ core.Pipe({ name: "stringifier" })
7517
+ ], StringifierPipe);
7518
+ return StringifierPipe;
7519
+ }());
7520
+
7521
+ var StringifierPipeModule = /** @class */ (function () {
7522
+ function StringifierPipeModule() {
7523
+ }
7524
+ StringifierPipeModule = __decorate([
7525
+ core.NgModule({
7526
+ declarations: [StringifierPipe],
7527
+ imports: [common.CommonModule],
7528
+ exports: [StringifierPipe],
7529
+ })
7530
+ ], StringifierPipeModule);
7531
+ return StringifierPipeModule;
7532
+ }());
7533
+
7534
+ var TelephonePipe = /** @class */ (function () {
7535
+ function TelephonePipe() {
7536
+ }
7537
+ /**
7538
+ * Transforma um número de telefone aplicando máscara automaticamente.
7539
+ * @param value Valor do telefone.
7540
+ * @param withDDI Define se deve forçar formatação com DDI (mesmo que não exista).
7541
+ */
7542
+ TelephonePipe.prototype.transform = function (value, withDDI) {
7543
+ if (withDDI === void 0) { withDDI = false; }
7544
+ if (!value) {
7545
+ return "";
7546
+ }
7547
+ var digits = this.cleanDigits(value);
7548
+ if (!digits) {
7549
+ return value.toString();
7550
+ }
7551
+ var _a = this.extractParts(digits, withDDI), ddi = _a.ddi, ddd = _a.ddd, number = _a.number;
7552
+ return this.formatPhone(ddi, ddd, number, value.toString(), withDDI);
7553
+ };
7554
+ /** Remove todos os caracteres não numéricos */
7555
+ TelephonePipe.prototype.cleanDigits = function (value) {
7556
+ return value.toString().replace(/\D+/g, "");
7557
+ };
7558
+ /** Extrai DDI, DDD e número, considerando se deve aplicar DDI forçado */
7559
+ TelephonePipe.prototype.extractParts = function (digits, withDDI) {
7560
+ var len = digits.length;
7561
+ if (withDDI) {
7562
+ return this.extractWithDDI(digits);
7563
+ }
7564
+ if (len <= exports.AGRO_NUMBERS.NINE) {
7565
+ return { ddi: "", ddd: "", number: digits };
7566
+ }
7567
+ if (len <= exports.AGRO_NUMBERS.ELEVEN) {
7568
+ return this.extractWithDDD(digits);
7569
+ }
7570
+ return this.extractWithDDI(digits);
7571
+ };
7572
+ /** Extrai DDD e número (sem DDI) */
7573
+ TelephonePipe.prototype.extractWithDDD = function (digits) {
7574
+ var ddd = digits.slice(0, 2);
7575
+ var number = digits.slice(2);
7576
+ return { ddi: "", ddd: ddd, number: number };
7577
+ };
7578
+ /** Extrai DDI, DDD e número */
7579
+ TelephonePipe.prototype.extractWithDDI = function (digits) {
7580
+ var len = digits.length;
7581
+ var ddiLen = exports.AGRO_NUMBERS.ONE;
7582
+ if (len >= exports.AGRO_NUMBERS.FOURTEEN) {
7583
+ ddiLen = exports.AGRO_NUMBERS.THREE;
7584
+ }
7585
+ if (len >= exports.AGRO_NUMBERS.TWELVE) {
7586
+ ddiLen = exports.AGRO_NUMBERS.TWO;
7587
+ }
7588
+ var ddi = digits.slice(exports.AGRO_NUMBERS.ZERO, ddiLen);
7589
+ var ddd = digits.slice(ddiLen, ddiLen + exports.AGRO_NUMBERS.TWO);
7590
+ var number = digits.slice(ddiLen + exports.AGRO_NUMBERS.TWO);
7591
+ return { ddi: ddi, ddd: ddd, number: number };
7592
+ };
7593
+ /** Monta o número formatado */
7594
+ TelephonePipe.prototype.formatPhone = function (ddi, ddd, number, fallback, withDDI) {
7595
+ if (!number) {
7596
+ return fallback;
7597
+ }
7598
+ var formatted = "";
7599
+ if (withDDI || ddi) {
7600
+ formatted += "+" + (ddi || "55") + " ";
7601
+ }
7602
+ if (ddd) {
7603
+ formatted += "(" + ddd + ") ";
7604
+ }
7605
+ formatted += this.formatNumber(number);
7606
+ return formatted;
7607
+ };
7608
+ /** Aplica máscara de 8 ou 9 dígitos */
7609
+ TelephonePipe.prototype.formatNumber = function (number) {
7610
+ var len = number.length;
7611
+ if (len === exports.AGRO_NUMBERS.NINE) {
7612
+ return number.slice(exports.AGRO_NUMBERS.ZERO, exports.AGRO_NUMBERS.FIVE) + "-" + number.slice(exports.AGRO_NUMBERS.FIVE);
7613
+ }
7614
+ if (len === exports.AGRO_NUMBERS.EIGHT) {
7615
+ return number.slice(exports.AGRO_NUMBERS.ZERO, exports.AGRO_NUMBERS.FOUR) + "-" + number.slice(exports.AGRO_NUMBERS.FOUR);
7616
+ }
7617
+ return number;
7618
+ };
7619
+ TelephonePipe = __decorate([
7620
+ core.Pipe({ name: "telephone" })
7621
+ ], TelephonePipe);
7622
+ return TelephonePipe;
7623
+ }());
7624
+
7625
+ var TelephonePipeModule = /** @class */ (function () {
7626
+ function TelephonePipeModule() {
7627
+ }
7628
+ TelephonePipeModule = __decorate([
7629
+ core.NgModule({
7630
+ declarations: [TelephonePipe],
7631
+ imports: [common.CommonModule],
7632
+ exports: [TelephonePipe],
7633
+ })
7634
+ ], TelephonePipeModule);
7635
+ return TelephonePipeModule;
7636
+ }());
7637
+
7340
7638
  var HostProjectConfigsInjectionToken = new core.InjectionToken("hostProjectConfigs");
7341
7639
  var AgroAngularComponentsModule = /** @class */ (function () {
7342
7640
  function AgroAngularComponentsModule() {
@@ -7376,6 +7674,8 @@
7376
7674
  exports.AsyncLock = AsyncLock;
7377
7675
  exports.CancelEventDialogComponent = CancelEventDialogComponent;
7378
7676
  exports.CancelEventDialogModule = CancelEventDialogModule;
7677
+ exports.CnpjCpfPipe = CnpjCpfPipe;
7678
+ exports.CnpjCpfPipeModule = CnpjCpfPipeModule;
7379
7679
  exports.Colors = Colors;
7380
7680
  exports.E001TnsModule = E001TnsModule;
7381
7681
  exports.E001pesModule = E001pesModule;
@@ -7405,12 +7705,17 @@
7405
7705
  exports.ProducerInvoiceModule = ProducerInvoiceModule;
7406
7706
  exports.RuralEstateModule = RuralEstateModule;
7407
7707
  exports.SharedModule = SharedModule;
7708
+ exports.StringifierPipe = StringifierPipe;
7709
+ exports.StringifierPipeModule = StringifierPipeModule;
7710
+ exports.TelephonePipe = TelephonePipe;
7711
+ exports.TelephonePipeModule = TelephonePipeModule;
7408
7712
  exports.TicketModule = TicketModule;
7409
7713
  exports.TransferModule = TransferModule;
7410
7714
  exports.UserInformationService = UserInformationService;
7411
7715
  exports.WebsocketModule = WebsocketModule;
7412
7716
  exports.WebsocketService = WebsocketService;
7413
- exports.ɵa = LibTranslationService;
7717
+ exports.ɵa = LibTranslatePipe;
7718
+ exports.ɵb = LibTranslationService;
7414
7719
 
7415
7720
  Object.defineProperty(exports, '__esModule', { value: true });
7416
7721