@senior-agronegocio/angular-components 0.0.9864 → 0.0.9865

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 (68) hide show
  1. package/bundles/senior-agronegocio-angular-components.umd.js +30 -335
  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-regex.constant.d.ts +0 -3
  6. package/common/agro-string-utils.class.d.ts +0 -8
  7. package/components/financial-title-table/financial-title-table.component.d.ts +1 -1
  8. package/components/financial-title-table/index.d.ts +1 -1
  9. package/components/financial-title-table/services/financial/index.d.ts +2 -0
  10. package/esm2015/common/agro-platform-utils.class.js +7 -8
  11. package/esm2015/common/agro-regex.constant.js +2 -5
  12. package/esm2015/common/agro-string-utils.class.js +11 -89
  13. package/esm2015/components/financial-title-table/financial-title-table.component.js +2 -2
  14. package/esm2015/components/financial-title-table/index.js +2 -2
  15. package/esm2015/components/financial-title-table/services/financial/index.js +2 -1
  16. package/esm2015/pipe/index.js +1 -4
  17. package/esm2015/public-api.js +3 -3
  18. package/esm2015/senior-agronegocio-angular-components.js +2 -3
  19. package/esm2015/services/lib-translation.service.js +2 -2
  20. package/esm5/common/agro-platform-utils.class.js +7 -8
  21. package/esm5/common/agro-regex.constant.js +2 -5
  22. package/esm5/common/agro-string-utils.class.js +17 -106
  23. package/esm5/components/financial-title-table/financial-title-table.component.js +2 -2
  24. package/esm5/components/financial-title-table/index.js +2 -2
  25. package/esm5/components/financial-title-table/services/financial/index.js +2 -1
  26. package/esm5/pipe/index.js +1 -4
  27. package/esm5/public-api.js +3 -3
  28. package/esm5/senior-agronegocio-angular-components.js +2 -3
  29. package/esm5/services/lib-translation.service.js +2 -2
  30. package/fesm2015/senior-agronegocio-angular-components.js +20 -281
  31. package/fesm2015/senior-agronegocio-angular-components.js.map +1 -1
  32. package/fesm5/senior-agronegocio-angular-components.js +26 -324
  33. package/fesm5/senior-agronegocio-angular-components.js.map +1 -1
  34. package/package.json +55 -7
  35. package/pipe/index.d.ts +0 -3
  36. package/public-api.d.ts +2 -2
  37. package/senior-agronegocio-angular-components.d.ts +1 -2
  38. package/senior-agronegocio-angular-components.metadata.json +1 -1
  39. package/common/agro-object-stringifier.class.d.ts +0 -16
  40. package/esm2015/common/agro-object-stringifier.class.js +0 -31
  41. package/esm2015/pipe/cnpj-cpf/cnpj-cpf.pipe.js +0 -28
  42. package/esm2015/pipe/cnpj-cpf/cnpj-cpf.pipe.module.js +0 -15
  43. package/esm2015/pipe/cnpj-cpf/index.js +0 -3
  44. package/esm2015/pipe/stringifier/index.js +0 -3
  45. package/esm2015/pipe/stringifier/stringifier.pipe.js +0 -13
  46. package/esm2015/pipe/stringifier/stringifier.pipe.module.js +0 -15
  47. package/esm2015/pipe/telephone/index.js +0 -3
  48. package/esm2015/pipe/telephone/telephone.pipe.js +0 -91
  49. package/esm2015/pipe/telephone/telephone.pipe.module.js +0 -15
  50. package/esm5/common/agro-object-stringifier.class.js +0 -35
  51. package/esm5/pipe/cnpj-cpf/cnpj-cpf.pipe.js +0 -35
  52. package/esm5/pipe/cnpj-cpf/cnpj-cpf.pipe.module.js +0 -18
  53. package/esm5/pipe/cnpj-cpf/index.js +0 -3
  54. package/esm5/pipe/stringifier/index.js +0 -3
  55. package/esm5/pipe/stringifier/stringifier.pipe.js +0 -16
  56. package/esm5/pipe/stringifier/stringifier.pipe.module.js +0 -18
  57. package/esm5/pipe/telephone/index.js +0 -3
  58. package/esm5/pipe/telephone/telephone.pipe.js +0 -95
  59. package/esm5/pipe/telephone/telephone.pipe.module.js +0 -18
  60. package/pipe/cnpj-cpf/cnpj-cpf.pipe.d.ts +0 -4
  61. package/pipe/cnpj-cpf/cnpj-cpf.pipe.module.d.ts +0 -2
  62. package/pipe/cnpj-cpf/index.d.ts +0 -2
  63. package/pipe/stringifier/index.d.ts +0 -2
  64. package/pipe/stringifier/stringifier.pipe.d.ts +0 -9
  65. package/pipe/stringifier/stringifier.pipe.module.d.ts +0 -2
  66. package/pipe/telephone/index.d.ts +0 -2
  67. package/pipe/telephone/telephone.pipe.d.ts +0 -21
  68. package/pipe/telephone/telephone.pipe.module.d.ts +0 -2
@@ -185,10 +185,7 @@ var AGRO_REGEX = {
185
185
  * Validação de Placa de Veículo Antiga
186
186
  * Formato: AAA-0000
187
187
  */
188
- isOldLicensePlate: /^[A-Z]{3}\d{4}$/,
189
- isISODate: /^\d{4}-\d{2}-\d{2}$/,
190
- isISOTime: /^\d{2}:\d{2}:\d{2}$/,
191
- isISODateTime: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/,
188
+ isOldLicensePlate: /^[A-Z]{3}[0-9]{4}$/
192
189
  };
193
190
 
194
191
  var NumberComparisonType;
@@ -2118,19 +2115,13 @@ var AgroStringUtils = /** @class */ (function () {
2118
2115
  */
2119
2116
  AgroStringUtils.isEmpty = function (str) {
2120
2117
  var _a;
2121
- if (str && AgroStringUtils.isString(str)) {
2122
- return ((_a = str === null || str === void 0 ? void 0 : str.trim()) === null || _a === void 0 ? void 0 : _a.length) === AGRO_NUMBERS.ZERO;
2123
- }
2124
- return true;
2118
+ return !str || ((_a = str.trim()) === null || _a === void 0 ? void 0 : _a.length) === AGRO_NUMBERS.ZERO;
2125
2119
  };
2126
2120
  /**
2127
2121
  * Verifica se a string não está vazia.
2128
2122
  */
2129
2123
  AgroStringUtils.isNotEmpty = function (str) {
2130
- if (str && AgroStringUtils.isString(str)) {
2131
- return !AgroStringUtils.isEmpty(str);
2132
- }
2133
- return false;
2124
+ return !AgroStringUtils.isEmpty(str);
2134
2125
  };
2135
2126
  /** Verifica se a string é nula, indefinida ou contém apenas espaços em branco */
2136
2127
  AgroStringUtils.isBlank = function (str) {
@@ -2185,7 +2176,7 @@ var AgroStringUtils = /** @class */ (function () {
2185
2176
  return AGRO_REGEX.isUUID.test(str);
2186
2177
  };
2187
2178
  AgroStringUtils.isNumber = function (str) {
2188
- return [AGRO_REGEX.isNumber.test(str), AGRO_REGEX.isDecimal.test(str)].includes(true);
2179
+ return AGRO_REGEX.isNumber.test(str);
2189
2180
  };
2190
2181
  AgroStringUtils.validateCPF = function (cpf) {
2191
2182
  cpf = cpf.replace(/\D/g, "");
@@ -2202,7 +2193,7 @@ var AgroStringUtils = /** @class */ (function () {
2202
2193
  };
2203
2194
  var digit1 = calcVerifier(cpf, AGRO_NUMBERS.NINE);
2204
2195
  var digit2 = calcVerifier(cpf, AGRO_NUMBERS.TEN);
2205
- return (digit1 === parseInt(cpf[AGRO_NUMBERS.NINE], AGRO_NUMBERS.TEN) && digit2 === parseInt(cpf[AGRO_NUMBERS.TEN], AGRO_NUMBERS.TEN));
2196
+ return digit1 === parseInt(cpf[AGRO_NUMBERS.NINE], AGRO_NUMBERS.TEN) && digit2 === parseInt(cpf[AGRO_NUMBERS.TEN], AGRO_NUMBERS.TEN);
2206
2197
  };
2207
2198
  /**
2208
2199
  * Detecta automaticamente se é CNPJ antigo ou novo formato.
@@ -2245,8 +2236,7 @@ var AgroStringUtils = /** @class */ (function () {
2245
2236
  }
2246
2237
  resto = soma % AGRO_NUMBERS.ELEVEN;
2247
2238
  var digito2 = resto < AGRO_NUMBERS.TWO ? AGRO_NUMBERS.ZERO : AGRO_NUMBERS.ELEVEN - resto;
2248
- return (parseInt(cnpj.charAt(AGRO_NUMBERS.TWELVE), AGRO_NUMBERS.TEN) === digito1 &&
2249
- parseInt(cnpj.charAt(AGRO_NUMBERS.THIRTEEN), AGRO_NUMBERS.TEN) === digito2);
2239
+ return parseInt(cnpj.charAt(AGRO_NUMBERS.TWELVE), AGRO_NUMBERS.TEN) === digito1 && parseInt(cnpj.charAt(AGRO_NUMBERS.THIRTEEN), AGRO_NUMBERS.TEN) === digito2;
2250
2240
  };
2251
2241
  /**
2252
2242
  * Valida o CNPJ em formato alfanumérico (padrão 2026)
@@ -2342,93 +2332,20 @@ var AgroStringUtils = /** @class */ (function () {
2342
2332
  var matches = str.match(regex);
2343
2333
  return matches ? matches.length : AGRO_NUMBERS.ZERO;
2344
2334
  };
2345
- /**
2346
- * Remove uma máscara simples da string fornecida.O padrão de máscaras é definido pelo enum AgroStringMasks ou
2347
- * pode ser uma string personalizada onde '9' representa um dígito a ser mantido da string.
2348
- */
2349
- AgroStringUtils.removeMask = function (value, mask) {
2350
- var e_1, _a;
2351
- if (!value || !mask) {
2352
- return value;
2353
- }
2354
- var valueChars = value.toString().split("");
2355
- var maskChars = mask.split("");
2356
- var unmaskedValue = "";
2357
- var j = 0;
2358
- var isDigit = function (c) { return /\d/.test(c); };
2359
- var isAlpha = function (c) { return /[A-Za-z]/.test(c); };
2360
- var isAlnum = function (c) { return /[A-Za-z0-9]/.test(c); };
2361
- var extractNext = function (testFn) {
2362
- var k = j;
2363
- while (k < valueChars.length && !testFn(valueChars[k])) {
2364
- k++;
2365
- }
2366
- if (k < valueChars.length) {
2367
- var found = valueChars[k];
2368
- j = k + 1;
2369
- return found;
2370
- }
2371
- var fallback = valueChars[j];
2372
- j++;
2373
- return fallback;
2374
- };
2375
- var processMaskChar = function (maskChar) {
2376
- var _a, _b;
2377
- if (j >= valueChars.length) {
2378
- return;
2379
- }
2380
- var current = valueChars[j];
2381
- switch (maskChar) {
2382
- case "9":
2383
- unmaskedValue += (_a = extractNext(isDigit)) !== null && _a !== void 0 ? _a : "";
2384
- break;
2385
- case "A":
2386
- unmaskedValue += (_b = extractNext(isAlpha)) !== null && _b !== void 0 ? _b : "";
2387
- break;
2388
- default:
2389
- handleSeparator(maskChar, current);
2390
- break;
2391
- }
2392
- };
2393
- var handleSeparator = function (maskChar, current) {
2394
- if (current === maskChar) {
2395
- j++; // separador presente no valor
2396
- }
2397
- if (isAlnum(current)) {
2398
- unmaskedValue += current;
2399
- j++;
2400
- }
2401
- // se for pontuação diferente, apenas ignora (não consome j)
2402
- };
2403
- try {
2404
- for (var maskChars_1 = __values(maskChars), maskChars_1_1 = maskChars_1.next(); !maskChars_1_1.done; maskChars_1_1 = maskChars_1.next()) {
2405
- var maskChar = maskChars_1_1.value;
2406
- processMaskChar(maskChar);
2407
- }
2408
- }
2409
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2410
- finally {
2411
- try {
2412
- if (maskChars_1_1 && !maskChars_1_1.done && (_a = maskChars_1.return)) _a.call(maskChars_1);
2413
- }
2414
- finally { if (e_1) throw e_1.error; }
2415
- }
2416
- return unmaskedValue;
2417
- };
2418
2335
  /**
2419
2336
  * Aplica uma máscara simples à string fornecida.O padrão de máscaras é definido pelo enum AgroStringMasks ou
2420
2337
  * pode ser uma string personalizada onde '9' representa um dígito a ser substituído pelo caractere correspondente
2421
2338
  * da string.
2422
2339
  */
2423
2340
  AgroStringUtils.applyMask = function (value, mask) {
2424
- var e_2, _a;
2425
- var valueChars = AgroStringUtils.removeMask(value, mask).toString().split("");
2341
+ var e_1, _a;
2342
+ var valueChars = value.toString().split("");
2426
2343
  var maskChars = mask.split("");
2427
2344
  var maskedValue = "";
2428
2345
  var j = AGRO_NUMBERS.ZERO;
2429
2346
  try {
2430
- for (var maskChars_2 = __values(maskChars), maskChars_2_1 = maskChars_2.next(); !maskChars_2_1.done; maskChars_2_1 = maskChars_2.next()) {
2431
- var maskChar = maskChars_2_1.value;
2347
+ for (var maskChars_1 = __values(maskChars), maskChars_1_1 = maskChars_1.next(); !maskChars_1_1.done; maskChars_1_1 = maskChars_1.next()) {
2348
+ var maskChar = maskChars_1_1.value;
2432
2349
  if (j >= valueChars.length) {
2433
2350
  break;
2434
2351
  }
@@ -2441,12 +2358,12 @@ var AgroStringUtils = /** @class */ (function () {
2441
2358
  }
2442
2359
  }
2443
2360
  }
2444
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2361
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2445
2362
  finally {
2446
2363
  try {
2447
- if (maskChars_2_1 && !maskChars_2_1.done && (_a = maskChars_2.return)) _a.call(maskChars_2);
2364
+ if (maskChars_1_1 && !maskChars_1_1.done && (_a = maskChars_1.return)) _a.call(maskChars_1);
2448
2365
  }
2449
- finally { if (e_2) throw e_2.error; }
2366
+ finally { if (e_1) throw e_1.error; }
2450
2367
  }
2451
2368
  return maskedValue;
2452
2369
  };
@@ -2456,15 +2373,6 @@ var AgroStringUtils = /** @class */ (function () {
2456
2373
  AgroStringUtils.isInvalid = function (str) {
2457
2374
  return !AgroStringUtils.isValid(str);
2458
2375
  };
2459
- AgroStringUtils.isISODate = function (value) {
2460
- return AGRO_REGEX.isISODate.test(value);
2461
- };
2462
- AgroStringUtils.isISOTime = function (value) {
2463
- return AGRO_REGEX.isISOTime.test(value);
2464
- };
2465
- AgroStringUtils.isISODatetime = function (value) {
2466
- return AGRO_REGEX.isISODateTime.test(value);
2467
- };
2468
2376
  AgroStringUtils.CNPJ_TRADICIONAL_PESOS_1 = [
2469
2377
  AGRO_NUMBERS.FIVE,
2470
2378
  AGRO_NUMBERS.FOUR,
@@ -2477,7 +2385,7 @@ var AgroStringUtils = /** @class */ (function () {
2477
2385
  AGRO_NUMBERS.FIVE,
2478
2386
  AGRO_NUMBERS.FOUR,
2479
2387
  AGRO_NUMBERS.THREE,
2480
- AGRO_NUMBERS.TWO,
2388
+ AGRO_NUMBERS.TWO
2481
2389
  ];
2482
2390
  AgroStringUtils.CNPJ_TRADICIONAL_PESOS_2 = [
2483
2391
  AGRO_NUMBERS.SIX,
@@ -2492,7 +2400,7 @@ var AgroStringUtils = /** @class */ (function () {
2492
2400
  AGRO_NUMBERS.FIVE,
2493
2401
  AGRO_NUMBERS.FOUR,
2494
2402
  AGRO_NUMBERS.THREE,
2495
- AGRO_NUMBERS.TWO,
2403
+ AGRO_NUMBERS.TWO
2496
2404
  ];
2497
2405
  // Pesos utilizados para cálculo de dígitos verificadores do CNPJ alfanumérico (2026)
2498
2406
  AgroStringUtils.CNPJ_ALFANUMERICO_PESOS_1 = [
@@ -2507,7 +2415,7 @@ var AgroStringUtils = /** @class */ (function () {
2507
2415
  AGRO_NUMBERS.FIVE,
2508
2416
  AGRO_NUMBERS.FOUR,
2509
2417
  AGRO_NUMBERS.THREE,
2510
- AGRO_NUMBERS.TWO,
2418
+ AGRO_NUMBERS.TWO
2511
2419
  ];
2512
2420
  AgroStringUtils.CNPJ_ALFANUMERICO_PESOS_2 = [
2513
2421
  AGRO_NUMBERS.SIX,
@@ -2522,7 +2430,7 @@ var AgroStringUtils = /** @class */ (function () {
2522
2430
  AGRO_NUMBERS.FIVE,
2523
2431
  AGRO_NUMBERS.FOUR,
2524
2432
  AGRO_NUMBERS.THREE,
2525
- AGRO_NUMBERS.TWO,
2433
+ AGRO_NUMBERS.TWO
2526
2434
  ];
2527
2435
  return AgroStringUtils;
2528
2436
  }());
@@ -2540,7 +2448,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2540
2448
  * @returns
2541
2449
  */
2542
2450
  AgroPlatformUtils.getCurrentTenant = function () {
2543
- var tenant = AgroPlatformUtils.getTokenField("tenantName");
2451
+ var tenant = AgroPlatformUtils.getTokenField('tenantName');
2544
2452
  if (tenant) {
2545
2453
  return tenant;
2546
2454
  }
@@ -2552,18 +2460,17 @@ var AgroPlatformUtils = /** @class */ (function () {
2552
2460
  * @returns
2553
2461
  */
2554
2462
  AgroPlatformUtils.getCurrentTenantLocale = function () {
2555
- var locale = AgroPlatformUtils.getTokenField("locale");
2463
+ var locale = AgroPlatformUtils.getTokenField('locale');
2556
2464
  if (locale) {
2557
2465
  return locale;
2558
2466
  }
2559
- throw new Error("'locale' n\u00E3o encontrado para o tenant atual.");
2467
+ throw new Error("Cookie: \"" + COOKIE_TOKEN + "\" n\u00E3o encontrado.");
2560
2468
  };
2561
2469
  /**
2562
2470
  * @deprecated Use getCurrentTenantLocale()
2563
2471
  * Mantido por compatibilidade retroativa.
2564
2472
  */
2565
2473
  AgroPlatformUtils.getCurrenTenantLocale = function () {
2566
- // legacy typo retained
2567
2474
  return AgroPlatformUtils.getCurrentTenantLocale();
2568
2475
  };
2569
2476
  /**
@@ -2572,7 +2479,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2572
2479
  * @returns string || null
2573
2480
  */
2574
2481
  AgroPlatformUtils.getCurrentUserName = function () {
2575
- var name = AgroPlatformUtils.getTokenField("fullName");
2482
+ var name = AgroPlatformUtils.getTokenField('fullName');
2576
2483
  return name || null;
2577
2484
  };
2578
2485
  /**
@@ -2581,7 +2488,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2581
2488
  * @returns string
2582
2489
  */
2583
2490
  AgroPlatformUtils.getCurrentUserEmail = function () {
2584
- var email = AgroPlatformUtils.getTokenField("email");
2491
+ var email = AgroPlatformUtils.getTokenField('email');
2585
2492
  if (!email) {
2586
2493
  console.info("Cookie: \"" + COOKIE_TOKEN + "\" n\u00E3o encontrado.");
2587
2494
  }
@@ -2616,7 +2523,7 @@ var AgroPlatformUtils = /** @class */ (function () {
2616
2523
  * Caso contrário, retorna uma instância de Error
2617
2524
  */
2618
2525
  AgroPlatformUtils.getCurrentAccessToken = function () {
2619
- var token = AgroPlatformUtils.getTokenField("access_token");
2526
+ var token = AgroPlatformUtils.getTokenField('access_token');
2620
2527
  if (!token) {
2621
2528
  console.info("Cookie: \"" + COOKIE_TOKEN + "\" n\u00E3o encontrado.");
2622
2529
  }
@@ -4472,7 +4379,7 @@ var LibTranslationService = /** @class */ (function () {
4472
4379
  this.setLang(this.getLangOfUser());
4473
4380
  }
4474
4381
  LibTranslationService.prototype.getLangOfUser = function () {
4475
- return AgroPlatformUtils.getCurrentTenantLocale() || "pt-BR";
4382
+ return AgroPlatformUtils.getCurrenTenantLocale() || "pt-BR";
4476
4383
  };
4477
4384
  LibTranslationService.prototype.setLang = function (lang) {
4478
4385
  this.currentTranslation = this.availableTranslations[lang] || {};
@@ -6938,8 +6845,8 @@ var FinancialTitleTableComponent = /** @class */ (function () {
6938
6845
  this.form = new FormGroup({
6939
6846
  titlesForm: new FormArray([], []),
6940
6847
  });
6941
- this.ngUnsubscribe = new EventEmitter();
6942
6848
  this.currentListParams = { page: 0, size: 10, sort: [], filterData: {} };
6849
+ this.ngUnsubscribe = new EventEmitter();
6943
6850
  registerLocaleData(localePt);
6944
6851
  }
6945
6852
  Object.defineProperty(FinancialTitleTableComponent.prototype, "titlesForm", {
@@ -7255,211 +7162,6 @@ var FinancialTitleTableModule = /** @class */ (function () {
7255
7162
  return FinancialTitleTableModule;
7256
7163
  }());
7257
7164
 
7258
- var CnpjCpfPipe = /** @class */ (function () {
7259
- function CnpjCpfPipe() {
7260
- }
7261
- CnpjCpfPipe.prototype.transform = function (value) {
7262
- var args = [];
7263
- for (var _i = 1; _i < arguments.length; _i++) {
7264
- args[_i - 1] = arguments[_i];
7265
- }
7266
- if (typeof value !== "string" && typeof value === "number") {
7267
- value = value === null || value === void 0 ? void 0 : value.toString();
7268
- }
7269
- if (typeof value !== "string") {
7270
- return value;
7271
- }
7272
- if (AgroStringUtils.validateCNPJ(value)) {
7273
- return AgroStringUtils.applyMask(value, AgroStringMasks.CNPJ);
7274
- }
7275
- if (AgroStringUtils.validateCPF(value)) {
7276
- return AgroStringUtils.applyMask(value, AgroStringMasks.CPF);
7277
- }
7278
- return value;
7279
- };
7280
- CnpjCpfPipe = __decorate([
7281
- Pipe({
7282
- name: "cnpjCpf",
7283
- })
7284
- ], CnpjCpfPipe);
7285
- return CnpjCpfPipe;
7286
- }());
7287
-
7288
- var CnpjCpfPipeModule = /** @class */ (function () {
7289
- function CnpjCpfPipeModule() {
7290
- }
7291
- CnpjCpfPipeModule = __decorate([
7292
- NgModule({
7293
- declarations: [CnpjCpfPipe],
7294
- imports: [CommonModule],
7295
- exports: [CnpjCpfPipe],
7296
- })
7297
- ], CnpjCpfPipeModule);
7298
- return CnpjCpfPipeModule;
7299
- }());
7300
-
7301
- var AgroObjectStringifier = /** @class */ (function () {
7302
- function AgroObjectStringifier() {
7303
- }
7304
- /**
7305
- * Formata um objeto concatenando valores segundo as chaves e pipes informados.
7306
- *
7307
- * @param separator Separador entre os valores (ex: "-")
7308
- * @param fields Campos a extrair. Podem conter subpropriedades ("propriedade.subPropriedade") e pipes ("propriedade|nomeDaPipe:arg1:arg2")
7309
- * @param obj Objeto origem
7310
- */
7311
- AgroObjectStringifier.formatObject = function (separator, fields, obj, usePipes) {
7312
- function mapField(field) {
7313
- var value = AgroObjectStringifier.resolvePath(obj, field);
7314
- if (usePipes === null || usePipes === void 0 ? void 0 : usePipes.hasOwnProperty(field)) {
7315
- return usePipes[field].transform(value);
7316
- }
7317
- return value !== null && value !== void 0 ? value : "";
7318
- }
7319
- function filterValid(v) {
7320
- return typeof v === "number" || AgroStringUtils.isValid(v);
7321
- }
7322
- return fields.map(mapField).filter(filterValid).join(" " + separator + " ");
7323
- };
7324
- /** Resolve um caminho tipo "empresa.cargo" dentro de um objeto */
7325
- AgroObjectStringifier.resolvePath = function (obj, path) {
7326
- function reducer(acc, key) {
7327
- return acc === null || acc === void 0 ? void 0 : acc[key];
7328
- }
7329
- return path.split(".").reduce(reducer, obj);
7330
- };
7331
- return AgroObjectStringifier;
7332
- }());
7333
-
7334
- var StringifierPipe = /** @class */ (function () {
7335
- function StringifierPipe() {
7336
- }
7337
- StringifierPipe.prototype.transform = function (value, separator, paths, pipes) {
7338
- return AgroObjectStringifier.formatObject(separator, paths, value, pipes);
7339
- };
7340
- StringifierPipe = __decorate([
7341
- Pipe({ name: "stringifier" })
7342
- ], StringifierPipe);
7343
- return StringifierPipe;
7344
- }());
7345
-
7346
- var StringifierPipeModule = /** @class */ (function () {
7347
- function StringifierPipeModule() {
7348
- }
7349
- StringifierPipeModule = __decorate([
7350
- NgModule({
7351
- declarations: [StringifierPipe],
7352
- imports: [CommonModule],
7353
- exports: [StringifierPipe],
7354
- })
7355
- ], StringifierPipeModule);
7356
- return StringifierPipeModule;
7357
- }());
7358
-
7359
- var TelephonePipe = /** @class */ (function () {
7360
- function TelephonePipe() {
7361
- }
7362
- /**
7363
- * Transforma um número de telefone aplicando máscara automaticamente.
7364
- * @param value Valor do telefone.
7365
- * @param withDDI Define se deve forçar formatação com DDI (mesmo que não exista).
7366
- */
7367
- TelephonePipe.prototype.transform = function (value, withDDI) {
7368
- if (withDDI === void 0) { withDDI = false; }
7369
- if (!value) {
7370
- return "";
7371
- }
7372
- var digits = this.cleanDigits(value);
7373
- if (!digits) {
7374
- return value.toString();
7375
- }
7376
- var _a = this.extractParts(digits, withDDI), ddi = _a.ddi, ddd = _a.ddd, number = _a.number;
7377
- return this.formatPhone(ddi, ddd, number, value.toString(), withDDI);
7378
- };
7379
- /** Remove todos os caracteres não numéricos */
7380
- TelephonePipe.prototype.cleanDigits = function (value) {
7381
- return value.toString().replace(/\D+/g, "");
7382
- };
7383
- /** Extrai DDI, DDD e número, considerando se deve aplicar DDI forçado */
7384
- TelephonePipe.prototype.extractParts = function (digits, withDDI) {
7385
- var len = digits.length;
7386
- if (withDDI) {
7387
- return this.extractWithDDI(digits);
7388
- }
7389
- if (len <= AGRO_NUMBERS.NINE) {
7390
- return { ddi: "", ddd: "", number: digits };
7391
- }
7392
- if (len <= AGRO_NUMBERS.ELEVEN) {
7393
- return this.extractWithDDD(digits);
7394
- }
7395
- return this.extractWithDDI(digits);
7396
- };
7397
- /** Extrai DDD e número (sem DDI) */
7398
- TelephonePipe.prototype.extractWithDDD = function (digits) {
7399
- var ddd = digits.slice(0, 2);
7400
- var number = digits.slice(2);
7401
- return { ddi: "", ddd: ddd, number: number };
7402
- };
7403
- /** Extrai DDI, DDD e número */
7404
- TelephonePipe.prototype.extractWithDDI = function (digits) {
7405
- var len = digits.length;
7406
- var ddiLen = AGRO_NUMBERS.ONE;
7407
- if (len >= AGRO_NUMBERS.FOURTEEN) {
7408
- ddiLen = AGRO_NUMBERS.THREE;
7409
- }
7410
- if (len >= AGRO_NUMBERS.TWELVE) {
7411
- ddiLen = AGRO_NUMBERS.TWO;
7412
- }
7413
- var ddi = digits.slice(AGRO_NUMBERS.ZERO, ddiLen);
7414
- var ddd = digits.slice(ddiLen, ddiLen + AGRO_NUMBERS.TWO);
7415
- var number = digits.slice(ddiLen + AGRO_NUMBERS.TWO);
7416
- return { ddi: ddi, ddd: ddd, number: number };
7417
- };
7418
- /** Monta o número formatado */
7419
- TelephonePipe.prototype.formatPhone = function (ddi, ddd, number, fallback, withDDI) {
7420
- if (!number) {
7421
- return fallback;
7422
- }
7423
- var formatted = "";
7424
- if (withDDI || ddi) {
7425
- formatted += "+" + (ddi || "55") + " ";
7426
- }
7427
- if (ddd) {
7428
- formatted += "(" + ddd + ") ";
7429
- }
7430
- formatted += this.formatNumber(number);
7431
- return formatted;
7432
- };
7433
- /** Aplica máscara de 8 ou 9 dígitos */
7434
- TelephonePipe.prototype.formatNumber = function (number) {
7435
- var len = number.length;
7436
- if (len === AGRO_NUMBERS.NINE) {
7437
- return number.slice(AGRO_NUMBERS.ZERO, AGRO_NUMBERS.FIVE) + "-" + number.slice(AGRO_NUMBERS.FIVE);
7438
- }
7439
- if (len === AGRO_NUMBERS.EIGHT) {
7440
- return number.slice(AGRO_NUMBERS.ZERO, AGRO_NUMBERS.FOUR) + "-" + number.slice(AGRO_NUMBERS.FOUR);
7441
- }
7442
- return number;
7443
- };
7444
- TelephonePipe = __decorate([
7445
- Pipe({ name: "telephone" })
7446
- ], TelephonePipe);
7447
- return TelephonePipe;
7448
- }());
7449
-
7450
- var TelephonePipeModule = /** @class */ (function () {
7451
- function TelephonePipeModule() {
7452
- }
7453
- TelephonePipeModule = __decorate([
7454
- NgModule({
7455
- declarations: [TelephonePipe],
7456
- imports: [CommonModule],
7457
- exports: [TelephonePipe],
7458
- })
7459
- ], TelephonePipeModule);
7460
- return TelephonePipeModule;
7461
- }());
7462
-
7463
7165
  var HostProjectConfigsInjectionToken = new InjectionToken("hostProjectConfigs");
7464
7166
  var AgroAngularComponentsModule = /** @class */ (function () {
7465
7167
  function AgroAngularComponentsModule() {
@@ -7487,5 +7189,5 @@ var AgroAngularComponentsModule = /** @class */ (function () {
7487
7189
  * Generated bundle index. Do not edit.
7488
7190
  */
7489
7191
 
7490
- export { AGRO_NUMBERS, AGRO_REGEX, AgroAngularComponentsModule, AgroArrayUtils, AgroCookieUtils, AgroDateUtils, AgroEntityStatus, AgroFinancialService, AgroFormValidator, AgroLogics, AgroNameUtils, AgroNumberUtils, AgroObjectUtils, AgroPlatformUtils, AgroStringMasks, AgroStringUtils, AsyncLock, CancelEventDialogComponent, CancelEventDialogModule, CnpjCpfPipe, CnpjCpfPipeModule, Colors, DateComparisonType, E001TnsModule, E001pesModule, E070EmpModule, E070FilModule, E075DerModule, E205depService, EventControlBoardComponent, EventControlBoardModule, EventControlBoardService, EventControlItemModule, EventControlModule, EventStepsComponent, EventStepsModule, ExternalInvoiceModule, FinancialTitleTableComponent, FinancialTitleTableModule, FixationModule, HostProjectConfigsInjectionToken, HttpCodes, InvoiceModule, LibTranslatePipe, LibTranslationModule, LibTranslationService, NumberComparisonType, OriginationModule, PaginatorStorageService, PrimitiveManager, ProducerInvoiceModule, RuralEstateModule, SharedModule, StringifierPipe, StringifierPipeModule, TelephonePipe, TelephonePipeModule, TicketModule, TransferModule, UserInformationService, WebsocketModule, WebsocketService, LibTranslatePipe as ɵa, LibTranslationService as ɵb };
7192
+ export { AGRO_NUMBERS, AGRO_REGEX, AgroAngularComponentsModule, AgroArrayUtils, AgroCookieUtils, AgroDateUtils, AgroEntityStatus, AgroFinancialService, AgroFormValidator, AgroLogics, AgroNameUtils, AgroNumberUtils, AgroObjectUtils, AgroPlatformUtils, AgroStringMasks, AgroStringUtils, AsyncLock, CancelEventDialogComponent, CancelEventDialogModule, Colors, DateComparisonType, E001TnsModule, E001pesModule, E070EmpModule, E070FilModule, E075DerModule, E205depService, EventControlBoardComponent, EventControlBoardModule, EventControlBoardService, EventControlItemModule, EventControlModule, EventStepsComponent, EventStepsModule, ExternalInvoiceModule, FinancialTitleTableComponent, FinancialTitleTableModule, FixationModule, HostProjectConfigsInjectionToken, HttpCodes, InvoiceModule, LibTranslatePipe, LibTranslationModule, LibTranslationService, NumberComparisonType, OriginationModule, PaginatorStorageService, PrimitiveManager, ProducerInvoiceModule, RuralEstateModule, SharedModule, StatusType, TicketModule, TransferModule, TypeAccount, UserInformationService, WebsocketModule, WebsocketService, LibTranslationService as ɵa };
7491
7193
  //# sourceMappingURL=senior-agronegocio-angular-components.js.map