@sankhyalabs/core 0.0.0-bugfix-dev-KB-44620.0 → 0.0.0-bugfix-dev-KB-53946.0
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/.docs/classes/Change.md +11 -11
- package/.docs/classes/DataUnit.md +180 -130
- package/.docs/classes/IDBRepository.md +22 -0
- package/.docs/classes/MaskFormatter.md +13 -9
- package/.docs/classes/SelectionInfo.md +25 -11
- package/.docs/enumerations/ChangeOperation.md +4 -4
- package/.docs/enumerations/SelectionMode.md +2 -2
- package/.docs/interfaces/DUActionInterceptor.md +1 -1
- package/.docs/interfaces/IRepository.md +18 -0
- package/.docs/interfaces/LoadDataRequest.md +1 -1
- package/.docs/interfaces/PageRequest.md +3 -3
- package/.docs/interfaces/QuickFilter.md +3 -3
- package/.docs/interfaces/Record.md +4 -4
- package/.docs/interfaces/SavedRecord.md +5 -5
- package/.docs/interfaces/WaitingChange.md +3 -3
- package/.docs/namespaces/MaskFormatter/type-aliases/MaskCharacter.md +1 -1
- package/.docs/namespaces/MaskFormatter/variables/MaskCharacter.md +1 -1
- package/.docs/type-aliases/DataUnitEventOptions.md +1 -1
- package/dist/dataunit/DataUnit.d.ts +16 -4
- package/dist/dataunit/DataUnit.js +41 -8
- package/dist/dataunit/DataUnit.js.map +1 -1
- package/dist/dataunit/formatting/PrettyFormatter.js +2 -2
- package/dist/dataunit/formatting/PrettyFormatter.js.map +1 -1
- package/dist/dataunit/loading/LoadDataRequest.d.ts +1 -1
- package/dist/dataunit/state/slice/SelectionSlice.js +2 -2
- package/dist/dataunit/state/slice/SelectionSlice.js.map +1 -1
- package/dist/repository/IRepository.d.ts +6 -0
- package/dist/repository/indexeddb/IDBRepository.d.ts +1 -0
- package/dist/repository/indexeddb/IDBRepository.js +3 -0
- package/dist/repository/indexeddb/IDBRepository.js.map +1 -1
- package/dist/utils/MaskFormatter.d.ts +2 -1
- package/dist/utils/MaskFormatter.js +5 -1
- package/dist/utils/MaskFormatter.js.map +1 -1
- package/dist/utils/SortingUtils.d.ts +9 -0
- package/dist/utils/SortingUtils.js +24 -0
- package/dist/utils/SortingUtils.js.map +1 -0
- package/package.json +1 -1
- package/reports/test-report.xml +73 -73
- package/src/dataunit/DataUnit.ts +56 -18
- package/src/dataunit/formatting/PrettyFormatter.ts +2 -2
- package/src/dataunit/loading/LoadDataRequest.ts +1 -1
- package/src/dataunit/state/slice/SelectionSlice.ts +2 -2
- package/src/repository/IRepository.ts +7 -0
- package/src/repository/indexeddb/IDBRepository.ts +4 -0
- package/src/utils/MaskFormatter.ts +5 -1
- package/src/utils/SortingUtils.ts +30 -0
package/reports/test-report.xml
CHANGED
|
@@ -1,151 +1,151 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<unitTest version="1">
|
|
3
3
|
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaModel.spec.ts">
|
|
4
|
-
<testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="
|
|
4
|
+
<testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="79"/>
|
|
5
5
|
<testCase name="StringUtils it should modify "expressions" and "parameters" properties through Setters methods" duration="1"/>
|
|
6
6
|
<testCase name="StringUtils it should return "expression" and "parameters" setted through constructor method" duration="1"/>
|
|
7
7
|
<testCase name="StringUtils it should return a Criteria class with "expression" and "parameters" as needed setted through "append" method" duration="1"/>
|
|
8
8
|
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "append" method" duration="2"/>
|
|
9
9
|
<testCase name="StringUtils it should return undefined as "expression" and "[]" as parameters as we use an empty criteria as first entry in the constructor" duration="1"/>
|
|
10
|
-
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "OR" method" duration="
|
|
10
|
+
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "OR" method" duration="94"/>
|
|
11
11
|
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
12
12
|
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
13
|
-
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "AND" method" duration="
|
|
14
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="
|
|
15
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="
|
|
13
|
+
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
14
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
15
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
16
16
|
<testCase name="StringUtils it should return a toJSON object with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
17
|
-
<testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="
|
|
17
|
+
<testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="1"/>
|
|
18
18
|
</file>
|
|
19
19
|
<file path="/builds/dti/design-system/sankhyacore/test/util/MaskFormatter.spec.ts">
|
|
20
|
-
<testCase name="Mask Formatter mask:CPF complete valid" duration="
|
|
21
|
-
<testCase name="Mask Formatter mask:CPF complete valid literals" duration="
|
|
20
|
+
<testCase name="Mask Formatter mask:CPF complete valid" duration="89"/>
|
|
21
|
+
<testCase name="Mask Formatter mask:CPF complete valid literals" duration="1"/>
|
|
22
22
|
<testCase name="Mask Formatter mask:CPF incomplete valid" duration="1"/>
|
|
23
23
|
<testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="1"/>
|
|
24
24
|
<testCase name="Mask Formatter mask:CPF too long valid" duration="1"/>
|
|
25
|
-
<testCase name="Mask Formatter mask:CPF invalid for string" duration="
|
|
26
|
-
<testCase name="Mask Formatter mask:CPF invalid for being too long" duration="
|
|
25
|
+
<testCase name="Mask Formatter mask:CPF invalid for string" duration="113"/>
|
|
26
|
+
<testCase name="Mask Formatter mask:CPF invalid for being too long" duration="1"/>
|
|
27
27
|
<testCase name="Mask Formatter mask:Licence plate valid uppercase" duration="1"/>
|
|
28
28
|
<testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="1"/>
|
|
29
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="5"/>
|
|
30
|
+
<testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="1"/>
|
|
31
|
+
<testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="0"/>
|
|
29
32
|
<testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
|
|
30
|
-
<testCase name="Mask Formatter mask:Licence plate
|
|
31
|
-
<testCase name="Mask Formatter mask:Licence plate
|
|
33
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
34
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
|
|
32
35
|
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
33
36
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
34
37
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
35
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="0"/>
|
|
36
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="1"/>
|
|
37
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
|
|
38
38
|
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
39
39
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
40
40
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
|
|
41
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="
|
|
41
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="83"/>
|
|
42
42
|
</file>
|
|
43
43
|
<file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
|
|
44
44
|
<testCase name="HttpProvider Metodo GET" duration="0"/>
|
|
45
45
|
</file>
|
|
46
|
-
<file path="/builds/dti/design-system/sankhyacore/test/
|
|
47
|
-
<testCase name="
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<testCase name="
|
|
51
|
-
<testCase name="
|
|
52
|
-
<testCase name="
|
|
53
|
-
<testCase name="
|
|
54
|
-
<testCase name="
|
|
55
|
-
<testCase name="
|
|
56
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="3"/>
|
|
57
|
-
<testCase name="OverflowWatcher should ignore elements that can not overflow" duration="98"/>
|
|
58
|
-
<testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="1"/>
|
|
46
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/StringUtils.spec.ts">
|
|
47
|
+
<testCase name="StringUtils valor vazio" duration="1"/>
|
|
48
|
+
<testCase name="StringUtils valor em branco" duration="0"/>
|
|
49
|
+
<testCase name="StringUtils valor null" duration="0"/>
|
|
50
|
+
<testCase name="StringUtils valor undefined" duration="0"/>
|
|
51
|
+
<testCase name="StringUtils valor 0" duration="0"/>
|
|
52
|
+
<testCase name="StringUtils com valor" duration="1"/>
|
|
53
|
+
<testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="1"/>
|
|
54
|
+
<testCase name="StringUtils should return the original value when called with an object without a toString method" duration="2"/>
|
|
55
|
+
<testCase name="StringUtils should return the original value when called with undefined" duration="1"/>
|
|
59
56
|
</file>
|
|
60
57
|
<file path="/builds/dti/design-system/sankhyacore/test/util/NumberUtils.spec.ts">
|
|
61
|
-
<testCase name="StringUtils stringToNumber" duration="
|
|
62
|
-
<testCase name="StringUtils format" duration="
|
|
58
|
+
<testCase name="StringUtils stringToNumber" duration="176"/>
|
|
59
|
+
<testCase name="StringUtils format" duration="110"/>
|
|
63
60
|
<testCase name="StringUtils format without formatnumber parameter" duration="1"/>
|
|
64
61
|
<testCase name="StringUtils format without formatnumber parameter" duration="1"/>
|
|
65
62
|
<testCase name="StringUtils format round number" duration="2"/>
|
|
66
63
|
</file>
|
|
64
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/OverflowWatcher.spec.ts">
|
|
65
|
+
<testCase name="OverflowWatcher should initialize with provided parameters" duration="97"/>
|
|
66
|
+
<testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="2"/>
|
|
67
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate" duration="212"/>
|
|
68
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="93"/>
|
|
69
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="91"/>
|
|
70
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="7"/>
|
|
71
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="5"/>
|
|
72
|
+
<testCase name="OverflowWatcher should ignore elements that can not overflow" duration="96"/>
|
|
73
|
+
<testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="1"/>
|
|
74
|
+
</file>
|
|
75
|
+
<file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
|
|
76
|
+
<testCase name="HttpProvider Metodo POST" duration="0"/>
|
|
77
|
+
</file>
|
|
67
78
|
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
|
|
68
|
-
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the constructor" duration="
|
|
79
|
+
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the constructor" duration="8"/>
|
|
69
80
|
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the setters methods" duration="0"/>
|
|
70
81
|
<testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="1"/>
|
|
71
82
|
</file>
|
|
72
|
-
<file path="/builds/dti/design-system/sankhyacore/test/util/StringUtils.spec.ts">
|
|
73
|
-
<testCase name="StringUtils valor vazio" duration="1"/>
|
|
74
|
-
<testCase name="StringUtils valor em branco" duration="0"/>
|
|
75
|
-
<testCase name="StringUtils valor null" duration="0"/>
|
|
76
|
-
<testCase name="StringUtils valor undefined" duration="1"/>
|
|
77
|
-
<testCase name="StringUtils valor 0" duration="0"/>
|
|
78
|
-
<testCase name="StringUtils com valor" duration="0"/>
|
|
79
|
-
<testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="87"/>
|
|
80
|
-
<testCase name="StringUtils should return the original value when called with an object without a toString method" duration="3"/>
|
|
81
|
-
<testCase name="StringUtils should return the original value when called with undefined" duration="1"/>
|
|
82
|
-
</file>
|
|
83
83
|
<file path="/builds/dti/design-system/sankhyacore/test/util/TimeFormatter.spec.ts">
|
|
84
84
|
<testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="2"/>
|
|
85
|
-
<testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="
|
|
85
|
+
<testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="0"/>
|
|
86
86
|
<testCase name="TimeFormatter Case: validateTime" duration="1"/>
|
|
87
87
|
</file>
|
|
88
88
|
<file path="/builds/dti/design-system/sankhyacore/test/util/DataUnitStorage.spec.ts">
|
|
89
|
-
<testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="
|
|
90
|
-
<testCase name="DataUnitStorage get should return the stored DataUnit instance from the DataUnitStorage" duration="
|
|
91
|
-
<testCase name="DataUnitStorage get should return undefined if the DataUnit instance is not found in the DataUnitStorage" duration="
|
|
89
|
+
<testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="5"/>
|
|
90
|
+
<testCase name="DataUnitStorage get should return the stored DataUnit instance from the DataUnitStorage" duration="0"/>
|
|
91
|
+
<testCase name="DataUnitStorage get should return undefined if the DataUnit instance is not found in the DataUnitStorage" duration="0"/>
|
|
92
92
|
<testCase name="DataUnitStorage remove should remove the specified DataUnit instance from the DataUnitStorage" duration="1"/>
|
|
93
|
-
<testCase name="DataUnitStorage remove should remove the DataUnit instance with the specified name from the DataUnitStorage" duration="
|
|
94
|
-
<testCase name="DataUnitStorage remove should not remove any DataUnit instance if the specified DataUnit instance or name is not found in the DataUnitStorage" duration="
|
|
93
|
+
<testCase name="DataUnitStorage remove should remove the DataUnit instance with the specified name from the DataUnitStorage" duration="1"/>
|
|
94
|
+
<testCase name="DataUnitStorage remove should not remove any DataUnit instance if the specified DataUnit instance or name is not found in the DataUnitStorage" duration="0"/>
|
|
95
95
|
</file>
|
|
96
96
|
<file path="/builds/dti/design-system/sankhyacore/test/util/ElementIDUtils.spec.ts">
|
|
97
97
|
<testCase name="addIDInfo 1 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="12"/>
|
|
98
98
|
<testCase name="addIDInfo 2 - should add data-element-id with valid id "brComSankhyaFinCadMovimentacaofinanceira_snkApplication"" duration="2"/>
|
|
99
99
|
<testCase name="addIDInfo 3 - should add data-element-id with valid id "movFinanceira_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="2"/>
|
|
100
100
|
<testCase name="addIDInfo 4 - should add data-element-id with valid id "meuID2_snkApplication"" duration="1"/>
|
|
101
|
-
<testCase name="addIDInfo 5 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="
|
|
102
|
-
<testCase name="addIDInfo 6 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="
|
|
103
|
-
<testCase name="addIDInfo 7 - should add data-element-id with valid id "componenteNameTest_snkApplication"" duration="
|
|
104
|
-
<testCase name="addIDInfo 8 - should add data-element-id with valid id "componentLabel_snkApplication"" duration="
|
|
105
|
-
<testCase name="addIDInfo 9 - should add data-element-id with valid id "dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="
|
|
106
|
-
<testCase name="addIDInfo 10 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="
|
|
107
|
-
<testCase name="addIDInfo 11 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="
|
|
101
|
+
<testCase name="addIDInfo 5 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="1"/>
|
|
102
|
+
<testCase name="addIDInfo 6 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="2"/>
|
|
103
|
+
<testCase name="addIDInfo 7 - should add data-element-id with valid id "componenteNameTest_snkApplication"" duration="1"/>
|
|
104
|
+
<testCase name="addIDInfo 8 - should add data-element-id with valid id "componentLabel_snkApplication"" duration="2"/>
|
|
105
|
+
<testCase name="addIDInfo 9 - should add data-element-id with valid id "dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="2"/>
|
|
106
|
+
<testCase name="addIDInfo 10 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="2"/>
|
|
107
|
+
<testCase name="addIDInfo 11 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="1"/>
|
|
108
108
|
<testCase name="addIDInfo 12 - should add data-element-id with valid id "dataunitFinanceiro_movFinanceira_movimentacaoFinanceira"" duration="2"/>
|
|
109
|
-
<testCase name="addIDInfo 13 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="
|
|
110
|
-
<testCase name="addIDInfo 14 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira"" duration="
|
|
109
|
+
<testCase name="addIDInfo 13 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="14"/>
|
|
110
|
+
<testCase name="addIDInfo 14 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira"" duration="4"/>
|
|
111
111
|
<testCase name="addIDInfo 15 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_snkApplication"" duration="1"/>
|
|
112
112
|
<testCase name="addIDInfo 16 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_snkApplication"" duration="1"/>
|
|
113
113
|
<testCase name="addIDInfo 17 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
114
|
-
<testCase name="addIDInfo 18 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="
|
|
114
|
+
<testCase name="addIDInfo 18 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
115
115
|
<testCase name="addIDInfo 19 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
116
|
-
<testCase name="addIDInfo 20 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="
|
|
117
|
-
<testCase name="addIDInfo 21 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="
|
|
116
|
+
<testCase name="addIDInfo 20 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="0"/>
|
|
117
|
+
<testCase name="addIDInfo 21 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
118
118
|
<testCase name="addIDInfo 22 - should add data-element-id with valid id "bancoObrigatorio_movimentacaoFinanceira"" duration="1"/>
|
|
119
119
|
</file>
|
|
120
120
|
<file path="/builds/dti/design-system/sankhyacore/test/util/ElementUtils.spec.ts">
|
|
121
|
-
<testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="
|
|
121
|
+
<testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="63"/>
|
|
122
122
|
<testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="2"/>
|
|
123
|
-
<testCase name="calcMarginSize should threat values defined as zero" duration="
|
|
123
|
+
<testCase name="calcMarginSize should threat values defined as zero" duration="3"/>
|
|
124
124
|
</file>
|
|
125
125
|
<file path="/builds/dti/design-system/sankhyacore/test/dataunit/formatting/PrettyFormatter.spec.ts">
|
|
126
|
-
<testCase name="getFormattedValue should return empty string when value is null" duration="
|
|
127
|
-
<testCase name="getFormattedValue should return empty string when value is not an array" duration="
|
|
126
|
+
<testCase name="getFormattedValue should return empty string when value is null" duration="4"/>
|
|
127
|
+
<testCase name="getFormattedValue should return empty string when value is not an array" duration="1"/>
|
|
128
128
|
<testCase name="getFormattedValue should return empty string when value is an empty array" duration="0"/>
|
|
129
129
|
<testCase name="getFormattedValue should return file name when value is an array with one file object" duration="0"/>
|
|
130
130
|
<testCase name="getFormattedValue should return file count when value is an array with multiple file objects" duration="1"/>
|
|
131
131
|
<testCase name="getFormattedValue should return empty string for undefined file" duration="0"/>
|
|
132
|
-
<testCase name="getFormattedValue should handle OBJECT type with value field" duration="
|
|
132
|
+
<testCase name="getFormattedValue should handle OBJECT type with value field" duration="0"/>
|
|
133
133
|
<testCase name="getFormattedValue should return empty string when value is undefined" duration="0"/>
|
|
134
134
|
<testCase name="getFormattedValue should return value as string when value is not an object" duration="0"/>
|
|
135
|
-
<testCase name="getFormattedValue should return value.toString() when value is an object without value property" duration="
|
|
136
|
-
<testCase name="getFormattedValue should handle BOOLEAN type" duration="
|
|
135
|
+
<testCase name="getFormattedValue should return value.toString() when value is an object without value property" duration="1"/>
|
|
136
|
+
<testCase name="getFormattedValue should handle BOOLEAN type" duration="0"/>
|
|
137
137
|
<testCase name="getFormattedValue should format numbers correctly" duration="10"/>
|
|
138
138
|
<testCase name="getFormattedValue should format dates correctly" duration="5"/>
|
|
139
139
|
<testCase name="getFormattedValue should format times correctly" duration="0"/>
|
|
140
|
-
<testCase name="getFormattedValue should format datetime correctly" duration="
|
|
141
|
-
<testCase name="getFormattedValue should call toString with correct parameters" duration="
|
|
140
|
+
<testCase name="getFormattedValue should format datetime correctly" duration="0"/>
|
|
141
|
+
<testCase name="getFormattedValue should call toString with correct parameters" duration="1"/>
|
|
142
142
|
<testCase name="getFormattedValue should handle undefined descriptor gracefully" duration="0"/>
|
|
143
|
-
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and matching option" duration="
|
|
143
|
+
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and matching option" duration="1"/>
|
|
144
144
|
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="0"/>
|
|
145
145
|
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and value as object" duration="0"/>
|
|
146
|
-
<testCase name="getFormattedValue should return empty string with OPTIONSELECTOR and value as null" duration="
|
|
146
|
+
<testCase name="getFormattedValue should return empty string with OPTIONSELECTOR and value as null" duration="1"/>
|
|
147
147
|
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and options as JSON string" duration="0"/>
|
|
148
|
-
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and options as empty array" duration="
|
|
148
|
+
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and options as empty array" duration="1"/>
|
|
149
149
|
<testCase name="getFormattedValue should format masked values correctly" duration="1"/>
|
|
150
150
|
</file>
|
|
151
151
|
</unitTest>
|
package/src/dataunit/DataUnit.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { v4 as uuid } from "uuid";
|
|
|
26
26
|
import { DataUnitStorage } from "./DataUnitStorage.js";
|
|
27
27
|
import { getInvalidFieldMessage, InvalidFieldsReducer } from "./state/slice/InvalidFieldsSlice.js";
|
|
28
28
|
import { getLoadingProperties, LoadingPropertiesReducer } from "./state/slice/LoadingProperties.js";
|
|
29
|
+
import SortingUtils from "../utils/SortingUtils.js";
|
|
29
30
|
|
|
30
31
|
/***
|
|
31
32
|
* `DataUnit`: Atua como uma camada de abstração entre o back-end e a interface do usuário.
|
|
@@ -33,6 +34,7 @@ import { getLoadingProperties, LoadingPropertiesReducer } from "./state/slice/Lo
|
|
|
33
34
|
export default class DataUnit {
|
|
34
35
|
|
|
35
36
|
public static CHANGING_PAGE_LOADING_SOURCE = "CHANGING_PAGE_LOADING_SOURCE";
|
|
37
|
+
public static ALL_RECORDS_SELECTION_SOURCE = "ALL_RECORDS_SELECTION_SOURCE";
|
|
36
38
|
public static DEFAULT_DATAUNIT_NAME = "dataunit";
|
|
37
39
|
|
|
38
40
|
private _uuid: string;
|
|
@@ -55,6 +57,7 @@ export default class DataUnit {
|
|
|
55
57
|
public saveLoader?: (dataUnit: DataUnit, changes: Array<Change>) => Promise<Array<SavedRecord>>;
|
|
56
58
|
public removeLoader?: (dataUnit: DataUnit, recordIds: Array<string>) => Promise<Array<string>>;
|
|
57
59
|
public recordLoader?: (dataUnit: DataUnit, recordIds: Array<string>) => Promise<Array<Record>>;
|
|
60
|
+
public allRecordsLoader?: (dataUnit: DataUnit) => Array<Record> | undefined;
|
|
58
61
|
|
|
59
62
|
constructor(name: string = DataUnit.DEFAULT_DATAUNIT_NAME, parentDataUnit?: DataUnit) {
|
|
60
63
|
this._uuid = uuid()
|
|
@@ -184,6 +187,8 @@ export default class DataUnit {
|
|
|
184
187
|
case Action.NEXT_SELECTED:
|
|
185
188
|
case Action.PREVIOUS_SELECTED:
|
|
186
189
|
case Action.DATA_LOADED:
|
|
190
|
+
case Action.RECORDS_ADDED:
|
|
191
|
+
case Action.EDITION_CANCELED:
|
|
187
192
|
this.clearDataUnit();
|
|
188
193
|
const selectedRecord = this._parentDataUnit?.getSelectedRecord();
|
|
189
194
|
if(selectedRecord != undefined && !this.isNewRecord(selectedRecord.__record__id__)){
|
|
@@ -548,8 +553,8 @@ export default class DataUnit {
|
|
|
548
553
|
if(selection.isAllRecords()){
|
|
549
554
|
throw new Error("Exclusão remota não implementada.");
|
|
550
555
|
}
|
|
551
|
-
const records = selection?.records || [];
|
|
552
|
-
const recordIds = selection?.recordIds || [];
|
|
556
|
+
const records = selection?.records as Array<Record> || [];
|
|
557
|
+
const recordIds = selection?.recordIds as Array<string> || [];
|
|
553
558
|
return this.removeRecords(recordIds, records, buffered, undefined, silent);
|
|
554
559
|
}
|
|
555
560
|
return Promise.resolve([]);
|
|
@@ -651,13 +656,13 @@ export default class DataUnit {
|
|
|
651
656
|
*/
|
|
652
657
|
public getFormattedValue(fieldName: string, value?: any): string {
|
|
653
658
|
const descriptor = this.getField(fieldName);
|
|
654
|
-
if (value
|
|
659
|
+
if (value == undefined) {
|
|
655
660
|
value = this.getFieldValue(fieldName);
|
|
656
661
|
} else if (typeof value === "string" && descriptor?.dataType != DataType.TEXT){
|
|
657
662
|
value = this.valueFromString(fieldName, value);
|
|
658
663
|
}
|
|
659
664
|
|
|
660
|
-
if(value
|
|
665
|
+
if(value == undefined){
|
|
661
666
|
return "";
|
|
662
667
|
}
|
|
663
668
|
|
|
@@ -885,8 +890,12 @@ export default class DataUnit {
|
|
|
885
890
|
public copySelected(executionCtx?: ExecutionContext): void {
|
|
886
891
|
const selectionInfo = this.getSelectionInfo();
|
|
887
892
|
if (selectionInfo) {
|
|
888
|
-
|
|
893
|
+
if(selectionInfo.isAllRecords()){
|
|
894
|
+
throw new Error("Erro interno: Impossível copiar os registros selecionados pois a seleção atual é virtual.");
|
|
895
|
+
}
|
|
896
|
+
const selectedRecords = selectionInfo.records as Array<Record>;
|
|
889
897
|
if(selectedRecords){
|
|
898
|
+
|
|
890
899
|
this.dispatchAction(Action.RECORDS_COPIED, prepareCopiedRecord(this._stateManager, selectedRecords, this.getParentRecordId()), executionCtx);
|
|
891
900
|
}
|
|
892
901
|
}
|
|
@@ -1102,7 +1111,7 @@ export default class DataUnit {
|
|
|
1102
1111
|
public setSelection(selection: Array<string> | SelectionMode.ALL_RECORDS, executionCtx?: ExecutionContext): Promise<SelectionInfo> {
|
|
1103
1112
|
return new Promise(resolve => {
|
|
1104
1113
|
this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection }, executionCtx)
|
|
1105
|
-
.then(()=>resolve(getSelectionInfo(
|
|
1114
|
+
.then(()=>resolve(this.getSelectionInfo()));
|
|
1106
1115
|
});
|
|
1107
1116
|
}
|
|
1108
1117
|
|
|
@@ -1159,8 +1168,16 @@ export default class DataUnit {
|
|
|
1159
1168
|
* @returns - Objeto com informações como registros selecionados e seleção por critério.
|
|
1160
1169
|
*
|
|
1161
1170
|
**/
|
|
1162
|
-
public getSelectionInfo(): SelectionInfo
|
|
1163
|
-
|
|
1171
|
+
public getSelectionInfo(): SelectionInfo{
|
|
1172
|
+
const selectionInfo: SelectionInfo = getSelectionInfo(this._stateManager);
|
|
1173
|
+
selectionInfo.getAllRecords = () => this.allRecordsLoader?.(this);
|
|
1174
|
+
|
|
1175
|
+
if (selectionInfo.sort != undefined && selectionInfo.sort.length > 0) {
|
|
1176
|
+
const sortingFunction = SortingUtils.getSortingFunction(this, selectionInfo.sort)
|
|
1177
|
+
selectionInfo.records?.sort(sortingFunction)
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
return selectionInfo;
|
|
1164
1181
|
}
|
|
1165
1182
|
|
|
1166
1183
|
/**
|
|
@@ -1261,14 +1278,28 @@ export default class DataUnit {
|
|
|
1261
1278
|
/**
|
|
1262
1279
|
*
|
|
1263
1280
|
* Retorna se existe algum tipo de alteração pendente.
|
|
1264
|
-
*
|
|
1281
|
+
*
|
|
1282
|
+
* @param ignoreChildren: Define se deverá ignorar alterações pendentes no DataUnit filho.
|
|
1265
1283
|
* @returns Verdadeiro se existir alterações pendentes.
|
|
1266
1284
|
*
|
|
1267
1285
|
*/
|
|
1268
|
-
public isDirty(): boolean {
|
|
1286
|
+
public isDirty(ignoreChildren?: boolean): boolean {
|
|
1287
|
+
if(ignoreChildren) return isDirty(this._stateManager);
|
|
1288
|
+
|
|
1269
1289
|
return isDirty(this._stateManager) || this.childrenIsDirty();
|
|
1270
1290
|
}
|
|
1271
1291
|
|
|
1292
|
+
/**
|
|
1293
|
+
*
|
|
1294
|
+
* Retorna se existe alterações pendentes no DataUnit pai.
|
|
1295
|
+
*
|
|
1296
|
+
* @returns Verdadeiro se existir alterações pendentes e Falso caso não exista alterações ou não exista DataUnit pai.
|
|
1297
|
+
*
|
|
1298
|
+
*/
|
|
1299
|
+
public isParentDirty(): boolean {
|
|
1300
|
+
return this._parentDataUnit ? this._parentDataUnit.isDirty(true) : false;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1272
1303
|
/**
|
|
1273
1304
|
*
|
|
1274
1305
|
* Retorna se existe algum DataUnit detail com alterações pendentes.
|
|
@@ -1712,7 +1743,7 @@ export default class DataUnit {
|
|
|
1712
1743
|
}
|
|
1713
1744
|
|
|
1714
1745
|
if (selection) {
|
|
1715
|
-
return selection.records
|
|
1746
|
+
return selection.records as Array<Record>;
|
|
1716
1747
|
}
|
|
1717
1748
|
}
|
|
1718
1749
|
|
|
@@ -1730,12 +1761,15 @@ export default class DataUnit {
|
|
|
1730
1761
|
public getSelection(): Array<string> {
|
|
1731
1762
|
console.warn("DataUnit: O método `getSelection` foi descontinuado. Use o método `getSelectionInfo`.");
|
|
1732
1763
|
const selection = this.getSelectionInfo();
|
|
1764
|
+
if(selection == undefined){
|
|
1765
|
+
return [];
|
|
1766
|
+
}
|
|
1733
1767
|
|
|
1734
|
-
if(selection
|
|
1768
|
+
if(selection.isAllRecords()){
|
|
1735
1769
|
throw new Error("Erro interno: Impossível retornar os registros selecionados. A seleção atual é virtual. Use o método `getSelectionInfo`.");
|
|
1736
1770
|
}
|
|
1737
1771
|
|
|
1738
|
-
return selection?.recordIds
|
|
1772
|
+
return selection?.recordIds as Array<string>;
|
|
1739
1773
|
}
|
|
1740
1774
|
|
|
1741
1775
|
/**
|
|
@@ -1916,12 +1950,13 @@ export enum SelectionMode{
|
|
|
1916
1950
|
|
|
1917
1951
|
export class SelectionInfo{
|
|
1918
1952
|
|
|
1919
|
-
private _records: Array<Record>;
|
|
1920
1953
|
public mode: SelectionMode;
|
|
1921
|
-
private _total?: number;
|
|
1922
1954
|
public filters?: Array<Filter>;
|
|
1923
1955
|
public sort?: Array<Sort>;
|
|
1924
|
-
|
|
1956
|
+
public getAllRecords?: () => Array<Record> | undefined;
|
|
1957
|
+
private _records: Array<Record>;
|
|
1958
|
+
private _total?: number;
|
|
1959
|
+
|
|
1925
1960
|
constructor(records: Array<Record>, mode: SelectionMode = SelectionMode.SOME_RECORDS, total?:number, filters?: Array<Filter>, sort?: Array<Sort>){
|
|
1926
1961
|
this._records = records;
|
|
1927
1962
|
this._total = total;
|
|
@@ -1932,7 +1967,10 @@ export class SelectionInfo{
|
|
|
1932
1967
|
|
|
1933
1968
|
public get records(): Array<Record> | undefined{
|
|
1934
1969
|
if(this.isAllRecords()){
|
|
1935
|
-
|
|
1970
|
+
if(this.getAllRecords != undefined){
|
|
1971
|
+
return this.getAllRecords();
|
|
1972
|
+
}
|
|
1973
|
+
throw new Error("Erro interno: Impossível retornar os registros selecionados numa seleção virtual.");
|
|
1936
1974
|
}
|
|
1937
1975
|
return this._records;
|
|
1938
1976
|
}
|
|
@@ -1951,7 +1989,7 @@ export class SelectionInfo{
|
|
|
1951
1989
|
if(this.isAllRecords()){
|
|
1952
1990
|
return this._total || 0;
|
|
1953
1991
|
}
|
|
1954
|
-
return this.records == undefined ? 0: this.records.length;
|
|
1992
|
+
return this.records == undefined ? 0 : (this.records as Array<Record>).length;
|
|
1955
1993
|
}
|
|
1956
1994
|
|
|
1957
1995
|
public isAllRecords(): boolean{
|
|
@@ -43,7 +43,7 @@ export const getFormattedValue = (value: any, descriptor?: FieldDescriptor) => {
|
|
|
43
43
|
const mask = getMask(value, descriptor);
|
|
44
44
|
if(mask != undefined){
|
|
45
45
|
try{
|
|
46
|
-
return new MaskFormatter(mask).format(value);
|
|
46
|
+
return new MaskFormatter(mask).format(value, true);
|
|
47
47
|
} catch(error){
|
|
48
48
|
console.warn(`Erro ao formatar valor: ${value}. Mascara: ${mask}. Erro: ${error}`);
|
|
49
49
|
}
|
|
@@ -53,7 +53,7 @@ export const getFormattedValue = (value: any, descriptor?: FieldDescriptor) => {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const getNumberFormat = (value: any, descriptor: FieldDescriptor) => {
|
|
56
|
-
if(
|
|
56
|
+
if(value === undefined || value === null) return "";
|
|
57
57
|
if(descriptor.userInterface === UserInterface.INTEGERNUMBER){
|
|
58
58
|
return value;
|
|
59
59
|
}
|
|
@@ -4,7 +4,7 @@ import { Filter, Sort } from "../metadata/UnitMetadata.js";
|
|
|
4
4
|
/** Atributos enviados na requisição de carregamento dos registros */
|
|
5
5
|
export interface LoadDataRequest {
|
|
6
6
|
/** De onde partiu o refresh. Por padrão a fonte não é identificada */
|
|
7
|
-
source?:
|
|
7
|
+
source?: string;
|
|
8
8
|
|
|
9
9
|
/** Indice inicial dos registros que será retornado */
|
|
10
10
|
offset?: number;
|
|
@@ -94,8 +94,8 @@ export const getSelection = (stateManager: StateManager): Array<string> => {
|
|
|
94
94
|
export const getSelectionInfo = (stateManager: StateManager): SelectionInfo => {
|
|
95
95
|
|
|
96
96
|
const selection = getSelectionState(stateManager);
|
|
97
|
+
const currentRequest = getCurrentRequest(stateManager);
|
|
97
98
|
if(selection && selection.mode === SelectionMode.ALL_RECORDS){
|
|
98
|
-
const currentRequest = getCurrentRequest(stateManager);
|
|
99
99
|
const paginationInfo: PaginationInfo | undefined = getPaginationInfo(stateManager);
|
|
100
100
|
return new SelectionInfo(
|
|
101
101
|
[],
|
|
@@ -106,7 +106,7 @@ export const getSelectionInfo = (stateManager: StateManager): SelectionInfo => {
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
return new SelectionInfo(getSelectionRecords(stateManager) || [], SelectionMode.SOME_RECORDS, undefined);
|
|
109
|
+
return new SelectionInfo(getSelectionRecords(stateManager) || [], SelectionMode.SOME_RECORDS, undefined, undefined, currentRequest?.sort);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
export const hasNext = (stateManager: StateManager): boolean => {
|
|
@@ -79,4 +79,11 @@ export interface IRepository<T>{
|
|
|
79
79
|
* @returns Promessa de quantidade
|
|
80
80
|
*/
|
|
81
81
|
count(): Promise<number>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Retorna todos os registros que estão em cache no momento
|
|
85
|
+
*
|
|
86
|
+
* @returns Todos registros que estão em cache no momento
|
|
87
|
+
*/
|
|
88
|
+
getFromCache(): Array<T> | undefined
|
|
82
89
|
}
|
|
@@ -320,6 +320,10 @@ export class IDBRepository<T> implements IRepository<T>{
|
|
|
320
320
|
const tx = db.transaction(this._addedStoreName);
|
|
321
321
|
return tx.objectStore(this._addedStoreName).getAll();
|
|
322
322
|
}
|
|
323
|
+
|
|
324
|
+
public getFromCache(): Array<T> | undefined{
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
323
327
|
}
|
|
324
328
|
|
|
325
329
|
/**
|
|
@@ -96,9 +96,13 @@ export class MaskFormatter {
|
|
|
96
96
|
* Formata a string passada baseada na máscara definda pelo atributo mask.
|
|
97
97
|
*
|
|
98
98
|
* @param value Valor a ser formatado.
|
|
99
|
+
* @param trimBefore Executa um trim para remover espaços em branco.
|
|
99
100
|
* @return O valor processado de acordo com o padrão.
|
|
100
101
|
*/
|
|
101
|
-
public format(value: string): string {
|
|
102
|
+
public format(value: string, trimBefore: boolean = false): string {
|
|
103
|
+
if(trimBefore){
|
|
104
|
+
value = value.trim();
|
|
105
|
+
}
|
|
102
106
|
let result: string = '';
|
|
103
107
|
const index: Array<number> = [0];
|
|
104
108
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import DataUnit from "../dataunit/DataUnit.js";
|
|
2
|
+
import { FieldDescriptor, Sort, SortMode } from "../dataunit/metadata/UnitMetadata.js";
|
|
3
|
+
import { FieldComparator } from "../dataunit/sorting/FieldComparator.js";
|
|
4
|
+
import { Record } from '../dataunit/DataUnit.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `SortingUtils`: Utilizado para auxiliar na ordenacao de registros.
|
|
8
|
+
*/
|
|
9
|
+
export default class SortingUtils {
|
|
10
|
+
|
|
11
|
+
public static getSortingFunction(dataUnit: DataUnit, sorting?: Array<Sort>): ((recordA: Record, recordB: Record) => number) | undefined {
|
|
12
|
+
|
|
13
|
+
if (sorting == undefined || sorting.length == 0) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (recordA, recordB) => {
|
|
18
|
+
for (const sort of sorting) {
|
|
19
|
+
if (sort.field){
|
|
20
|
+
const result = FieldComparator.compare(dataUnit.getField(sort.field) as FieldDescriptor, recordA, recordB, sort.mode === SortMode.ASC);
|
|
21
|
+
if (result != 0) {
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return 0;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|