sm-utility 2.4.28-beta-2 → 2.4.28-beta.3

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.
package/excel/enums.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const enum ExcelFormat {
1
+ export declare enum ExcelFormat {
2
2
  DATE = "MM/YYYY",
3
3
  PERCENTAGE = "0%",
4
4
  MONEY = "R$ 0.00",
@@ -7,6 +7,6 @@ export declare const enum ExcelFormat {
7
7
  FULL_DATE_BR = "DD/MM/YYYY",
8
8
  FULL_DATE_EN = "YYYY/MM/DD"
9
9
  }
10
- export declare const enum ExcelType {
10
+ export declare enum ExcelType {
11
11
  OPTIONS = "options"
12
12
  }
package/excel/enums.js CHANGED
@@ -1,2 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExcelType = exports.ExcelFormat = void 0;
4
+ var ExcelFormat;
5
+ (function (ExcelFormat) {
6
+ ExcelFormat["DATE"] = "MM/YYYY";
7
+ ExcelFormat["PERCENTAGE"] = "0%";
8
+ ExcelFormat["MONEY"] = "R$ 0.00";
9
+ ExcelFormat["ZERO_DEFAULT"] = "0";
10
+ ExcelFormat["NUMBER"] = "123";
11
+ ExcelFormat["FULL_DATE_BR"] = "DD/MM/YYYY";
12
+ ExcelFormat["FULL_DATE_EN"] = "YYYY/MM/DD";
13
+ })(ExcelFormat || (exports.ExcelFormat = ExcelFormat = {}));
14
+ var ExcelType;
15
+ (function (ExcelType) {
16
+ ExcelType["OPTIONS"] = "options";
17
+ })(ExcelType || (exports.ExcelType = ExcelType = {}));
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExcelCreatorCustomizer = void 0;
4
+ const enums_1 = require("../enums");
4
5
  class ExcelCreatorCustomizer {
5
6
  custom(element, structure) {
6
7
  if (!structure)
7
8
  return element;
8
9
  let formattedValue = element;
9
- if (structure.type === "options" /* ExcelType.OPTIONS */ && structure.options)
10
+ if (structure.type === enums_1.ExcelType.OPTIONS && structure.options)
10
11
  this.validOptionsValue(element, structure.options);
11
12
  if (structure.customFormat)
12
13
  formattedValue = this.formatValue(element, structure.customFormat);
@@ -24,36 +25,36 @@ class ExcelCreatorCustomizer {
24
25
  formatValue(value, customFormat) {
25
26
  var _a;
26
27
  switch (customFormat) {
27
- case "123" /* ExcelFormat.NUMBER */:
28
+ case enums_1.ExcelFormat.NUMBER:
28
29
  return value.toString();
29
- case "MM/YYYY" /* ExcelFormat.DATE */: {
30
+ case enums_1.ExcelFormat.DATE: {
30
31
  const date = new Date(value);
31
32
  const month = (date.getMonth() + 1).toString().padStart(2, '0');
32
33
  const year = date.getFullYear();
33
34
  return `${month}/${year}`;
34
35
  }
35
- case "DD/MM/YYYY" /* ExcelFormat.FULL_DATE_BR */: {
36
+ case enums_1.ExcelFormat.FULL_DATE_BR: {
36
37
  const date = new Date(value);
37
38
  const day = date.getDate().toString().padStart(2, '0');
38
39
  const month = (date.getMonth() + 1).toString().padStart(2, '0');
39
40
  const year = date.getFullYear();
40
41
  return `${day}/${month}/${year}`;
41
42
  }
42
- case "YYYY/MM/DD" /* ExcelFormat.FULL_DATE_EN */: {
43
+ case enums_1.ExcelFormat.FULL_DATE_EN: {
43
44
  const date = new Date(value);
44
45
  const day = date.getDate().toString().padStart(2, '0');
45
46
  const month = (date.getMonth() + 1).toString().padStart(2, '0');
46
47
  const year = date.getFullYear();
47
48
  return `${year}-${month}/${day}`;
48
49
  }
49
- case "R$ 0.00" /* ExcelFormat.MONEY */:
50
+ case enums_1.ExcelFormat.MONEY:
50
51
  return parseFloat(value).toLocaleString("pt-BR", {
51
52
  style: "currency",
52
53
  currency: "BRL",
53
54
  });
54
- case "0%" /* ExcelFormat.PERCENTAGE */:
55
+ case enums_1.ExcelFormat.PERCENTAGE:
55
56
  return `${value}%`;
56
- case "0" /* ExcelFormat.ZERO_DEFAULT */:
57
+ case enums_1.ExcelFormat.ZERO_DEFAULT:
57
58
  return (_a = value.toString()) !== null && _a !== void 0 ? _a : "0";
58
59
  default:
59
60
  return value;
package/excel/index.js CHANGED
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExcelParser = exports.ExcelCreator = void 0;
3
+ exports.ExcelType = exports.ExcelFormat = exports.ExcelParser = exports.ExcelCreator = void 0;
4
4
  var excelCreator_1 = require("./excel-creator/excelCreator");
5
5
  Object.defineProperty(exports, "ExcelCreator", { enumerable: true, get: function () { return excelCreator_1.ExcelCreator; } });
6
6
  var excelParser_1 = require("./excel-parser/excelParser");
7
7
  Object.defineProperty(exports, "ExcelParser", { enumerable: true, get: function () { return excelParser_1.ExcelParser; } });
8
+ var enums_1 = require("./enums");
9
+ Object.defineProperty(exports, "ExcelFormat", { enumerable: true, get: function () { return enums_1.ExcelFormat; } });
10
+ Object.defineProperty(exports, "ExcelType", { enumerable: true, get: function () { return enums_1.ExcelType; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sm-utility",
3
- "version": "2.4.28-beta-2",
3
+ "version": "2.4.28-beta.3",
4
4
  "description": "reusable utility codes for sm projects",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",