@sankhyalabs/core 1.0.39 → 1.0.43
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/.eslintignore +2 -0
- package/.eslintrc.cjs +34 -0
- package/dist/dataunit/DataUnit.d.ts +2 -2
- package/dist/dataunit/DataUnit.js +11 -11
- package/dist/dataunit/DataUnit.js.map +1 -1
- package/dist/dataunit/metadata/DataType.js.map +1 -1
- package/dist/dataunit/metadata/UnitMetadata.d.ts +1 -1
- package/dist/dataunit/state/HistReducer.d.ts +2 -2
- package/dist/dataunit/state/HistReducer.js +1 -1
- package/dist/dataunit/state/HistReducer.js.map +1 -1
- package/dist/dataunit/state/action/DataUnitAction.d.ts +1 -1
- package/dist/dataunit/state/slice/AddedRecordsSlice.d.ts +3 -3
- package/dist/dataunit/state/slice/AddedRecordsSlice.js +1 -1
- package/dist/dataunit/state/slice/AddedRecordsSlice.js.map +1 -1
- package/dist/dataunit/state/slice/ChangesSlice.d.ts +3 -3
- package/dist/dataunit/state/slice/ChangesSlice.js +6 -6
- package/dist/dataunit/state/slice/ChangesSlice.js.map +1 -1
- package/dist/dataunit/state/slice/CurrentRecordsSlice.d.ts +4 -4
- package/dist/dataunit/state/slice/CurrentRecordsSlice.js +6 -6
- package/dist/dataunit/state/slice/CurrentRecordsSlice.js.map +1 -1
- package/dist/dataunit/state/slice/RecordsSlice.d.ts +3 -3
- package/dist/dataunit/state/slice/RecordsSlice.js +2 -2
- package/dist/dataunit/state/slice/RecordsSlice.js.map +1 -1
- package/dist/dataunit/state/slice/RemovedRecordsSlice.d.ts +2 -2
- package/dist/dataunit/state/slice/RemovedRecordsSlice.js +1 -1
- package/dist/dataunit/state/slice/RemovedRecordsSlice.js.map +1 -1
- package/dist/dataunit/state/slice/SelectionSlice.d.ts +2 -2
- package/dist/dataunit/state/slice/SelectionSlice.js +2 -2
- package/dist/dataunit/state/slice/SelectionSlice.js.map +1 -1
- package/dist/dataunit/state/slice/UnitMetadataSlice.d.ts +3 -3
- package/dist/dataunit/state/slice/UnitMetadataSlice.js +1 -1
- package/dist/dataunit/state/slice/UnitMetadataSlice.js.map +1 -1
- package/dist/http/AuthorizedServiceCaller.js +4 -4
- package/dist/http/AuthorizedServiceCaller.js.map +1 -1
- package/dist/http/HttpProvider.d.ts +1 -1
- package/dist/http/HttpProvider.js +1 -1
- package/dist/http/HttpProvider.js.map +1 -1
- package/dist/http/SkwHttpProvider.js +1 -2
- package/dist/http/SkwHttpProvider.js.map +1 -1
- package/dist/index.d.ts +15 -15
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/ui/FloatingManager.js +0 -1
- package/dist/ui/FloatingManager.js.map +1 -1
- package/dist/utils/ApplicationContext.js +2 -3
- package/dist/utils/ApplicationContext.js.map +1 -1
- package/dist/utils/CriteriaModel.d.ts +1 -1
- package/dist/utils/CriteriaParameter.js +0 -2
- package/dist/utils/CriteriaParameter.js.map +1 -1
- package/dist/utils/DateUtils.js +6 -6
- package/dist/utils/DateUtils.js.map +1 -1
- package/dist/utils/NumberUtils.js +6 -11
- package/dist/utils/NumberUtils.js.map +1 -1
- package/dist/utils/TimeFormatter.d.ts +1 -1
- package/dist/utils/TimeFormatter.js +1 -1
- package/dist/utils/TimeFormatter.js.map +1 -1
- package/jest.config.ts +3 -0
- package/package.json +8 -2
- package/src/dataunit/DataUnit.ts +14 -14
- package/src/dataunit/metadata/DataType.ts +1 -1
- package/src/dataunit/metadata/UnitMetadata.ts +1 -1
- package/src/dataunit/state/HistReducer.ts +3 -3
- package/src/dataunit/state/action/DataUnitAction.ts +1 -1
- package/src/dataunit/state/slice/AddedRecordsSlice.ts +4 -4
- package/src/dataunit/state/slice/ChangesSlice.ts +8 -8
- package/src/dataunit/state/slice/CurrentRecordsSlice.ts +9 -9
- package/src/dataunit/state/slice/RecordsSlice.ts +5 -5
- package/src/dataunit/state/slice/RemovedRecordsSlice.ts +3 -3
- package/src/dataunit/state/slice/SelectionSlice.ts +5 -5
- package/src/dataunit/state/slice/UnitMetadataSlice.ts +4 -4
- package/src/http/AuthorizedServiceCaller.ts +5 -4
- package/src/http/HttpProvider.ts +1 -1
- package/src/http/SkwHttpProvider.ts +4 -4
- package/src/index.ts +15 -15
- package/src/ui/FloatingManager.ts +1 -1
- package/src/utils/ApplicationContext.ts +2 -3
- package/src/utils/CriteriaModel.ts +1 -1
- package/src/utils/CriteriaParameter.ts +2 -2
- package/src/utils/DateUtils.ts +6 -6
- package/src/utils/NumberUtils.ts +13 -13
- package/src/utils/TimeFormatter.ts +2 -2
package/src/utils/DateUtils.ts
CHANGED
|
@@ -21,12 +21,12 @@ export default class DateUtils{
|
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const day:number = monthYearMode ? 1 : Number(parts[1]);
|
|
25
|
+
const month:number = Number(parts[(monthYearMode ? 1 : 2)]);
|
|
26
|
+
let year:number = Number(parts[(monthYearMode ? 2 : 3)]);
|
|
27
|
+
const hour:number = Number(parts[(monthYearMode ? 3 : 4 )] || 0);
|
|
28
|
+
const min:number = Number(parts[(monthYearMode ? 4 : 5 )] || 0);
|
|
29
|
+
const sec:number = Number(parts[(monthYearMode ? 5 : 6 )] || 0);
|
|
30
30
|
|
|
31
31
|
if (year < 100) {
|
|
32
32
|
year += year < 30 ? 2000 : 1900;
|
package/src/utils/NumberUtils.ts
CHANGED
|
@@ -33,12 +33,12 @@ export class NumberUtils {
|
|
|
33
33
|
|
|
34
34
|
if (value === '' || value === null || value === undefined) {
|
|
35
35
|
return NaN;
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
|
|
38
38
|
if (value) {
|
|
39
39
|
value = value.toString();
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
const negative = (value.charAt(0) === '-');
|
|
42
42
|
|
|
43
43
|
if (!NUMBERINPUTS_REGEX_SCIENTIFIC_PARTS.test(value)) {
|
|
44
44
|
value = value.replace(/[^\d.,]/g, '');
|
|
@@ -51,8 +51,8 @@ export class NumberUtils {
|
|
|
51
51
|
return Number(NaN);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const indexV = value.indexOf(',');
|
|
55
|
+
const indexP = value.indexOf('.');
|
|
56
56
|
|
|
57
57
|
if (indexP > indexV) {
|
|
58
58
|
value = value.replace(',', '');
|
|
@@ -83,13 +83,13 @@ export class NumberUtils {
|
|
|
83
83
|
|
|
84
84
|
if (value === '' || value === undefined || value === "NaN") {
|
|
85
85
|
return NaN.toString();
|
|
86
|
-
}
|
|
86
|
+
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
const newValue: number = NumberUtils.stringToNumber(value);
|
|
89
89
|
|
|
90
|
-
if (newValue
|
|
90
|
+
if (isNaN(newValue)) {
|
|
91
91
|
return NaN.toString();
|
|
92
|
-
}
|
|
92
|
+
}
|
|
93
93
|
|
|
94
94
|
//Validation "precision":
|
|
95
95
|
// Case1: precision < 0 => does not use precision
|
|
@@ -97,14 +97,14 @@ export class NumberUtils {
|
|
|
97
97
|
if (precision < 0 || Math.abs(Math.round(precision * 1) / 1) !== precision) {
|
|
98
98
|
//Once stringToNumber returns number format, we need to change to pt-br
|
|
99
99
|
return NumberUtils.changeFormat(newValue.toString());
|
|
100
|
-
}
|
|
100
|
+
}
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
//Validation "prettyPrecision"
|
|
104
104
|
let prettyPrecisionInternal: number = 0;
|
|
105
105
|
// Case1: prettyPrecision < 0 => prettyPrecision does not change de format that means: prettyPrecisionInternal = precision;
|
|
106
106
|
// Case2: prettyPrecision not int => prettyPrecision does not change de format that means: prettyPrecisionInternal = precision;
|
|
107
|
-
if (prettyPrecision
|
|
107
|
+
if (isNaN(prettyPrecision) || Math.abs(Math.round(prettyPrecision * 1) / 1) !== prettyPrecision) {
|
|
108
108
|
prettyPrecisionInternal = precision;
|
|
109
109
|
} else {
|
|
110
110
|
prettyPrecisionInternal = prettyPrecision;
|
|
@@ -158,7 +158,7 @@ export class NumberUtils {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
return value;
|
|
161
|
-
}
|
|
161
|
+
}
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* @changeFormat: troca o formato do numero string de "PT-BR" para "EN-US" e vice-versa
|
|
@@ -170,6 +170,6 @@ export class NumberUtils {
|
|
|
170
170
|
static changeFormat = (value: string): string => {
|
|
171
171
|
//Formatting output following formatnumber
|
|
172
172
|
return value.replace(/\./g, '_').replace(/\,/g, '.').replace(/\_/g, ',');
|
|
173
|
-
}
|
|
173
|
+
}
|
|
174
174
|
|
|
175
|
-
}
|
|
175
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaskFormatter } from "./MaskFormatter";
|
|
1
|
+
import { MaskFormatter } from "./MaskFormatter.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `TimeFormatter` é um utilitário para formatação de strings desformatadas em strings válidas de horários
|
|
@@ -41,7 +41,7 @@ export class TimeFormatter {
|
|
|
41
41
|
try {
|
|
42
42
|
value = this._maskFormatter.format(validationValue);
|
|
43
43
|
return value;
|
|
44
|
-
} catch (e) {
|
|
44
|
+
} catch (e:any) {
|
|
45
45
|
throw new Error(e.message);
|
|
46
46
|
}
|
|
47
47
|
}
|