@sankhyalabs/core 5.20.0-dev.31 → 5.20.0-dev.33
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 +179 -129
- 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 +33 -8
- package/dist/dataunit/DataUnit.js.map +1 -1
- package/dist/dataunit/formatting/PrettyFormatter.js +1 -1
- package/dist/dataunit/formatting/PrettyFormatter.js.map +1 -1
- package/dist/dataunit/loading/LoadDataRequest.d.ts +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/package.json +1 -1
- package/reports/test-report.xml +78 -78
- package/src/dataunit/DataUnit.ts +47 -18
- package/src/dataunit/formatting/PrettyFormatter.ts +1 -1
- package/src/dataunit/loading/LoadDataRequest.ts +1 -1
- package/src/repository/IRepository.ts +7 -0
- package/src/repository/indexeddb/IDBRepository.ts +4 -0
- package/src/utils/MaskFormatter.ts +5 -1
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
|
+
<file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
|
|
4
|
+
<testCase name="HttpProvider Metodo GET" duration="13"/>
|
|
5
|
+
</file>
|
|
6
|
+
<file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
|
|
7
|
+
<testCase name="HttpProvider Metodo POST" duration="88"/>
|
|
8
|
+
</file>
|
|
9
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
|
|
10
|
+
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the constructor" duration="383"/>
|
|
11
|
+
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the setters methods" duration="101"/>
|
|
12
|
+
<testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="1"/>
|
|
13
|
+
</file>
|
|
3
14
|
<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="
|
|
5
|
-
<testCase name="StringUtils it should modify "expressions" and "parameters" properties through Setters methods" duration="
|
|
15
|
+
<testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="7"/>
|
|
16
|
+
<testCase name="StringUtils it should modify "expressions" and "parameters" properties through Setters methods" duration="1"/>
|
|
6
17
|
<testCase name="StringUtils it should return "expression" and "parameters" setted through constructor method" duration="1"/>
|
|
7
|
-
<testCase name="StringUtils it should return a Criteria class with "expression" and "parameters" as needed setted through "append" method" duration="
|
|
18
|
+
<testCase name="StringUtils it should return a Criteria class with "expression" and "parameters" as needed setted through "append" method" duration="89"/>
|
|
8
19
|
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "append" method" duration="1"/>
|
|
9
20
|
<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
21
|
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
11
22
|
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
12
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="
|
|
23
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
13
24
|
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "AND" method" duration="2"/>
|
|
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="
|
|
25
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="0"/>
|
|
26
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="0"/>
|
|
16
27
|
<testCase name="StringUtils it should return a toJSON object with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
17
28
|
<testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="0"/>
|
|
18
29
|
</file>
|
|
19
30
|
<file path="/builds/dti/design-system/sankhyacore/test/util/MaskFormatter.spec.ts">
|
|
20
|
-
<testCase name="Mask Formatter mask:CPF complete valid" duration="
|
|
31
|
+
<testCase name="Mask Formatter mask:CPF complete valid" duration="91"/>
|
|
21
32
|
<testCase name="Mask Formatter mask:CPF complete valid literals" duration="1"/>
|
|
22
|
-
<testCase name="Mask Formatter mask:CPF incomplete valid" duration="
|
|
23
|
-
<testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="
|
|
33
|
+
<testCase name="Mask Formatter mask:CPF incomplete valid" duration="2"/>
|
|
34
|
+
<testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="1"/>
|
|
24
35
|
<testCase name="Mask Formatter mask:CPF too long valid" duration="1"/>
|
|
25
|
-
<testCase name="Mask Formatter mask:CPF invalid for string" duration="
|
|
36
|
+
<testCase name="Mask Formatter mask:CPF invalid for string" duration="392"/>
|
|
26
37
|
<testCase name="Mask Formatter mask:CPF invalid for being too long" duration="1"/>
|
|
27
38
|
<testCase name="Mask Formatter mask:Licence plate valid uppercase" duration="1"/>
|
|
28
|
-
<testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="
|
|
29
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="
|
|
39
|
+
<testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="0"/>
|
|
40
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
|
|
30
41
|
<testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="0"/>
|
|
31
|
-
<testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="
|
|
42
|
+
<testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="3"/>
|
|
32
43
|
<testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
|
|
33
44
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
34
45
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
35
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="
|
|
46
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
36
47
|
<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="
|
|
48
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="77"/>
|
|
38
49
|
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
39
50
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
40
51
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
41
52
|
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
42
53
|
</file>
|
|
43
|
-
<file path="/builds/dti/design-system/sankhyacore/test/
|
|
44
|
-
<testCase name="
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<testCase name="HttpProvider Metodo POST" duration="1"/>
|
|
48
|
-
</file>
|
|
49
|
-
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
|
|
50
|
-
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the constructor" duration="2"/>
|
|
51
|
-
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the setters methods" duration="1"/>
|
|
52
|
-
<testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="1"/>
|
|
54
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/TimeFormatter.spec.ts">
|
|
55
|
+
<testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="3"/>
|
|
56
|
+
<testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="1"/>
|
|
57
|
+
<testCase name="TimeFormatter Case: validateTime" duration="1"/>
|
|
53
58
|
</file>
|
|
54
59
|
<file path="/builds/dti/design-system/sankhyacore/test/util/StringUtils.spec.ts">
|
|
55
|
-
<testCase name="StringUtils valor vazio" duration="
|
|
56
|
-
<testCase name="StringUtils valor em branco" duration="
|
|
60
|
+
<testCase name="StringUtils valor vazio" duration="6"/>
|
|
61
|
+
<testCase name="StringUtils valor em branco" duration="1"/>
|
|
57
62
|
<testCase name="StringUtils valor null" duration="1"/>
|
|
58
63
|
<testCase name="StringUtils valor undefined" duration="0"/>
|
|
59
64
|
<testCase name="StringUtils valor 0" duration="0"/>
|
|
60
|
-
<testCase name="StringUtils com valor" duration="
|
|
61
|
-
<testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="
|
|
62
|
-
<testCase name="StringUtils should return the original value when called with an object without a toString method" duration="
|
|
65
|
+
<testCase name="StringUtils com valor" duration="2"/>
|
|
66
|
+
<testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="2"/>
|
|
67
|
+
<testCase name="StringUtils should return the original value when called with an object without a toString method" duration="3"/>
|
|
63
68
|
<testCase name="StringUtils should return the original value when called with undefined" duration="0"/>
|
|
64
69
|
</file>
|
|
65
70
|
<file path="/builds/dti/design-system/sankhyacore/test/util/NumberUtils.spec.ts">
|
|
66
|
-
<testCase name="StringUtils stringToNumber" duration="
|
|
67
|
-
<testCase name="StringUtils format" duration="
|
|
71
|
+
<testCase name="StringUtils stringToNumber" duration="13"/>
|
|
72
|
+
<testCase name="StringUtils format" duration="107"/>
|
|
73
|
+
<testCase name="StringUtils format without formatnumber parameter" duration="1"/>
|
|
68
74
|
<testCase name="StringUtils format without formatnumber parameter" duration="1"/>
|
|
69
|
-
<testCase name="StringUtils format
|
|
70
|
-
<testCase name="StringUtils format round number" duration="2"/>
|
|
75
|
+
<testCase name="StringUtils format round number" duration="1"/>
|
|
71
76
|
</file>
|
|
72
77
|
<file path="/builds/dti/design-system/sankhyacore/test/util/OverflowWatcher.spec.ts">
|
|
73
|
-
<testCase name="OverflowWatcher should initialize with provided parameters" duration="
|
|
74
|
-
<testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="
|
|
75
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate" duration="
|
|
76
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="
|
|
77
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="
|
|
78
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="
|
|
79
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="
|
|
80
|
-
<testCase name="OverflowWatcher should ignore elements that can not overflow" duration="
|
|
81
|
-
<testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="
|
|
82
|
-
</file>
|
|
83
|
-
<file path="/builds/dti/design-system/sankhyacore/test/util/TimeFormatter.spec.ts">
|
|
84
|
-
<testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="1"/>
|
|
85
|
-
<testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="1"/>
|
|
86
|
-
<testCase name="TimeFormatter Case: validateTime" duration="1"/>
|
|
78
|
+
<testCase name="OverflowWatcher should initialize with provided parameters" duration="83"/>
|
|
79
|
+
<testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="2"/>
|
|
80
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate" duration="213"/>
|
|
81
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="95"/>
|
|
82
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="9"/>
|
|
83
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="75"/>
|
|
84
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="4"/>
|
|
85
|
+
<testCase name="OverflowWatcher should ignore elements that can not overflow" duration="10"/>
|
|
86
|
+
<testCase name="OverflowWatcher Should not call callback on forceUpdate" 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="
|
|
89
|
+
<testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="81"/>
|
|
90
|
+
<testCase name="DataUnitStorage get should return the stored DataUnit instance from the DataUnitStorage" duration="0"/>
|
|
91
91
|
<testCase name="DataUnitStorage get should return undefined if the DataUnit instance is not found in the DataUnitStorage" duration="1"/>
|
|
92
92
|
<testCase name="DataUnitStorage remove should remove the specified DataUnit instance from the DataUnitStorage" duration="1"/>
|
|
93
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="
|
|
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="6"/>
|
|
95
95
|
</file>
|
|
96
96
|
<file path="/builds/dti/design-system/sankhyacore/test/util/ElementIDUtils.spec.ts">
|
|
97
|
-
<testCase name="addIDInfo 1 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="
|
|
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
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="
|
|
102
|
+
<testCase name="addIDInfo 6 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="2"/>
|
|
103
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="
|
|
104
|
+
<testCase name="addIDInfo 8 - should add data-element-id with valid id "componentLabel_snkApplication"" duration="66"/>
|
|
105
105
|
<testCase name="addIDInfo 9 - should add data-element-id with valid id "dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="1"/>
|
|
106
106
|
<testCase name="addIDInfo 10 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="1"/>
|
|
107
|
-
<testCase name="addIDInfo 11 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="
|
|
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="1"/>
|
|
109
109
|
<testCase name="addIDInfo 13 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="1"/>
|
|
110
|
-
<testCase name="addIDInfo 14 - 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="5"/>
|
|
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
|
-
<testCase name="addIDInfo 17 - 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="
|
|
113
|
+
<testCase name="addIDInfo 17 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="0"/>
|
|
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="0"/>
|
|
118
118
|
<testCase name="addIDInfo 22 - should add data-element-id with valid id "bancoObrigatorio_movimentacaoFinanceira"" duration="1"/>
|
|
119
119
|
</file>
|
|
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="59"/>
|
|
122
|
+
<testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="3"/>
|
|
123
|
+
<testCase name="calcMarginSize should threat values defined as zero" duration="5"/>
|
|
124
|
+
</file>
|
|
120
125
|
<file path="/builds/dti/design-system/sankhyacore/test/dataunit/formatting/PrettyFormatter.spec.ts">
|
|
121
|
-
<testCase name="getFormattedValue should return empty string when value is null" duration="
|
|
126
|
+
<testCase name="getFormattedValue should return empty string when value is null" duration="5"/>
|
|
122
127
|
<testCase name="getFormattedValue should return empty string when value is not an array" duration="1"/>
|
|
123
|
-
<testCase name="getFormattedValue should return empty string when value is an empty array" duration="
|
|
124
|
-
<testCase name="getFormattedValue should return file name when value is an array with one file object" duration="
|
|
125
|
-
<testCase name="getFormattedValue should return file count when value is an array with multiple file objects" duration="
|
|
128
|
+
<testCase name="getFormattedValue should return empty string when value is an empty array" duration="0"/>
|
|
129
|
+
<testCase name="getFormattedValue should return file name when value is an array with one file object" duration="1"/>
|
|
130
|
+
<testCase name="getFormattedValue should return file count when value is an array with multiple file objects" duration="0"/>
|
|
126
131
|
<testCase name="getFormattedValue should return empty string for undefined file" duration="0"/>
|
|
127
|
-
<testCase name="getFormattedValue should handle OBJECT type with value field" duration="
|
|
132
|
+
<testCase name="getFormattedValue should handle OBJECT type with value field" duration="0"/>
|
|
128
133
|
<testCase name="getFormattedValue should return empty string when value is undefined" duration="0"/>
|
|
129
134
|
<testCase name="getFormattedValue should return value as string when value is not an object" duration="1"/>
|
|
130
135
|
<testCase name="getFormattedValue should return value.toString() when value is an object without value property" duration="0"/>
|
|
131
136
|
<testCase name="getFormattedValue should handle BOOLEAN type" duration="1"/>
|
|
132
|
-
<testCase name="getFormattedValue should format numbers correctly" duration="
|
|
137
|
+
<testCase name="getFormattedValue should format numbers correctly" duration="13"/>
|
|
133
138
|
<testCase name="getFormattedValue should format dates correctly" duration="4"/>
|
|
134
|
-
<testCase name="getFormattedValue should format times correctly" duration="
|
|
135
|
-
<testCase name="getFormattedValue should format datetime correctly" duration="
|
|
136
|
-
<testCase name="getFormattedValue should call toString with correct parameters" duration="
|
|
137
|
-
<testCase name="getFormattedValue should handle undefined descriptor gracefully" duration="
|
|
138
|
-
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and matching option" duration="
|
|
139
|
-
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="
|
|
139
|
+
<testCase name="getFormattedValue should format times correctly" duration="1"/>
|
|
140
|
+
<testCase name="getFormattedValue should format datetime correctly" duration="0"/>
|
|
141
|
+
<testCase name="getFormattedValue should call toString with correct parameters" duration="1"/>
|
|
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="1"/>
|
|
144
|
+
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="0"/>
|
|
140
145
|
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and value as object" duration="0"/>
|
|
141
146
|
<testCase name="getFormattedValue should return empty string with OPTIONSELECTOR and value as null" duration="0"/>
|
|
142
|
-
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and options as JSON string" duration="
|
|
147
|
+
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and options as JSON string" duration="0"/>
|
|
143
148
|
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and options as empty array" duration="0"/>
|
|
144
149
|
<testCase name="getFormattedValue should format masked values correctly" duration="1"/>
|
|
145
150
|
</file>
|
|
146
|
-
<file path="/builds/dti/design-system/sankhyacore/test/util/ElementUtils.spec.ts">
|
|
147
|
-
<testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="103"/>
|
|
148
|
-
<testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="4"/>
|
|
149
|
-
<testCase name="calcMarginSize should threat values defined as zero" duration="4"/>
|
|
150
|
-
</file>
|
|
151
151
|
</unitTest>
|
package/src/dataunit/DataUnit.ts
CHANGED
|
@@ -33,6 +33,7 @@ import { getLoadingProperties, LoadingPropertiesReducer } from "./state/slice/Lo
|
|
|
33
33
|
export default class DataUnit {
|
|
34
34
|
|
|
35
35
|
public static CHANGING_PAGE_LOADING_SOURCE = "CHANGING_PAGE_LOADING_SOURCE";
|
|
36
|
+
public static ALL_RECORDS_SELECTION_SOURCE = "ALL_RECORDS_SELECTION_SOURCE";
|
|
36
37
|
public static DEFAULT_DATAUNIT_NAME = "dataunit";
|
|
37
38
|
|
|
38
39
|
private _uuid: string;
|
|
@@ -55,6 +56,7 @@ export default class DataUnit {
|
|
|
55
56
|
public saveLoader?: (dataUnit: DataUnit, changes: Array<Change>) => Promise<Array<SavedRecord>>;
|
|
56
57
|
public removeLoader?: (dataUnit: DataUnit, recordIds: Array<string>) => Promise<Array<string>>;
|
|
57
58
|
public recordLoader?: (dataUnit: DataUnit, recordIds: Array<string>) => Promise<Array<Record>>;
|
|
59
|
+
public allRecordsLoader?: (dataUnit: DataUnit) => Array<Record> | undefined;
|
|
58
60
|
|
|
59
61
|
constructor(name: string = DataUnit.DEFAULT_DATAUNIT_NAME, parentDataUnit?: DataUnit) {
|
|
60
62
|
this._uuid = uuid()
|
|
@@ -550,8 +552,8 @@ export default class DataUnit {
|
|
|
550
552
|
if(selection.isAllRecords()){
|
|
551
553
|
throw new Error("Exclusão remota não implementada.");
|
|
552
554
|
}
|
|
553
|
-
const records = selection?.records || [];
|
|
554
|
-
const recordIds = selection?.recordIds || [];
|
|
555
|
+
const records = selection?.records as Array<Record> || [];
|
|
556
|
+
const recordIds = selection?.recordIds as Array<string> || [];
|
|
555
557
|
return this.removeRecords(recordIds, records, buffered, undefined, silent);
|
|
556
558
|
}
|
|
557
559
|
return Promise.resolve([]);
|
|
@@ -653,13 +655,13 @@ export default class DataUnit {
|
|
|
653
655
|
*/
|
|
654
656
|
public getFormattedValue(fieldName: string, value?: any): string {
|
|
655
657
|
const descriptor = this.getField(fieldName);
|
|
656
|
-
if (value
|
|
658
|
+
if (value == undefined) {
|
|
657
659
|
value = this.getFieldValue(fieldName);
|
|
658
660
|
} else if (typeof value === "string" && descriptor?.dataType != DataType.TEXT){
|
|
659
661
|
value = this.valueFromString(fieldName, value);
|
|
660
662
|
}
|
|
661
663
|
|
|
662
|
-
if(value
|
|
664
|
+
if(value == undefined){
|
|
663
665
|
return "";
|
|
664
666
|
}
|
|
665
667
|
|
|
@@ -887,8 +889,12 @@ export default class DataUnit {
|
|
|
887
889
|
public copySelected(executionCtx?: ExecutionContext): void {
|
|
888
890
|
const selectionInfo = this.getSelectionInfo();
|
|
889
891
|
if (selectionInfo) {
|
|
890
|
-
|
|
892
|
+
if(selectionInfo.isAllRecords()){
|
|
893
|
+
throw new Error("Erro interno: Impossível copiar os registros selecionados pois a seleção atual é virtual.");
|
|
894
|
+
}
|
|
895
|
+
const selectedRecords = selectionInfo.records as Array<Record>;
|
|
891
896
|
if(selectedRecords){
|
|
897
|
+
|
|
892
898
|
this.dispatchAction(Action.RECORDS_COPIED, prepareCopiedRecord(this._stateManager, selectedRecords, this.getParentRecordId()), executionCtx);
|
|
893
899
|
}
|
|
894
900
|
}
|
|
@@ -1104,7 +1110,7 @@ export default class DataUnit {
|
|
|
1104
1110
|
public setSelection(selection: Array<string> | SelectionMode.ALL_RECORDS, executionCtx?: ExecutionContext): Promise<SelectionInfo> {
|
|
1105
1111
|
return new Promise(resolve => {
|
|
1106
1112
|
this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection }, executionCtx)
|
|
1107
|
-
.then(()=>resolve(getSelectionInfo(
|
|
1113
|
+
.then(()=>resolve(this.getSelectionInfo()));
|
|
1108
1114
|
});
|
|
1109
1115
|
}
|
|
1110
1116
|
|
|
@@ -1161,8 +1167,10 @@ export default class DataUnit {
|
|
|
1161
1167
|
* @returns - Objeto com informações como registros selecionados e seleção por critério.
|
|
1162
1168
|
*
|
|
1163
1169
|
**/
|
|
1164
|
-
public getSelectionInfo(): SelectionInfo
|
|
1165
|
-
|
|
1170
|
+
public getSelectionInfo(): SelectionInfo{
|
|
1171
|
+
const selectionInfo: SelectionInfo = getSelectionInfo(this._stateManager);
|
|
1172
|
+
selectionInfo.getAllRecords = () => this.allRecordsLoader?.(this);
|
|
1173
|
+
return selectionInfo;
|
|
1166
1174
|
}
|
|
1167
1175
|
|
|
1168
1176
|
/**
|
|
@@ -1263,14 +1271,28 @@ export default class DataUnit {
|
|
|
1263
1271
|
/**
|
|
1264
1272
|
*
|
|
1265
1273
|
* Retorna se existe algum tipo de alteração pendente.
|
|
1266
|
-
*
|
|
1274
|
+
*
|
|
1275
|
+
* @param ignoreChildren: Define se deverá ignorar alterações pendentes no DataUnit filho.
|
|
1267
1276
|
* @returns Verdadeiro se existir alterações pendentes.
|
|
1268
1277
|
*
|
|
1269
1278
|
*/
|
|
1270
|
-
public isDirty(): boolean {
|
|
1279
|
+
public isDirty(ignoreChildren?: boolean): boolean {
|
|
1280
|
+
if(ignoreChildren) return isDirty(this._stateManager);
|
|
1281
|
+
|
|
1271
1282
|
return isDirty(this._stateManager) || this.childrenIsDirty();
|
|
1272
1283
|
}
|
|
1273
1284
|
|
|
1285
|
+
/**
|
|
1286
|
+
*
|
|
1287
|
+
* Retorna se existe alterações pendentes no DataUnit pai.
|
|
1288
|
+
*
|
|
1289
|
+
* @returns Verdadeiro se existir alterações pendentes e Falso caso não exista alterações ou não exista DataUnit pai.
|
|
1290
|
+
*
|
|
1291
|
+
*/
|
|
1292
|
+
public isParentDirty(): boolean {
|
|
1293
|
+
return this._parentDataUnit ? this._parentDataUnit.isDirty(true) : false;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1274
1296
|
/**
|
|
1275
1297
|
*
|
|
1276
1298
|
* Retorna se existe algum DataUnit detail com alterações pendentes.
|
|
@@ -1714,7 +1736,7 @@ export default class DataUnit {
|
|
|
1714
1736
|
}
|
|
1715
1737
|
|
|
1716
1738
|
if (selection) {
|
|
1717
|
-
return selection.records
|
|
1739
|
+
return selection.records as Array<Record>;
|
|
1718
1740
|
}
|
|
1719
1741
|
}
|
|
1720
1742
|
|
|
@@ -1732,12 +1754,15 @@ export default class DataUnit {
|
|
|
1732
1754
|
public getSelection(): Array<string> {
|
|
1733
1755
|
console.warn("DataUnit: O método `getSelection` foi descontinuado. Use o método `getSelectionInfo`.");
|
|
1734
1756
|
const selection = this.getSelectionInfo();
|
|
1757
|
+
if(selection == undefined){
|
|
1758
|
+
return [];
|
|
1759
|
+
}
|
|
1735
1760
|
|
|
1736
|
-
if(selection
|
|
1761
|
+
if(selection.isAllRecords()){
|
|
1737
1762
|
throw new Error("Erro interno: Impossível retornar os registros selecionados. A seleção atual é virtual. Use o método `getSelectionInfo`.");
|
|
1738
1763
|
}
|
|
1739
1764
|
|
|
1740
|
-
return selection?.recordIds
|
|
1765
|
+
return selection?.recordIds as Array<string>;
|
|
1741
1766
|
}
|
|
1742
1767
|
|
|
1743
1768
|
/**
|
|
@@ -1918,12 +1943,13 @@ export enum SelectionMode{
|
|
|
1918
1943
|
|
|
1919
1944
|
export class SelectionInfo{
|
|
1920
1945
|
|
|
1921
|
-
private _records: Array<Record>;
|
|
1922
1946
|
public mode: SelectionMode;
|
|
1923
|
-
private _total?: number;
|
|
1924
1947
|
public filters?: Array<Filter>;
|
|
1925
1948
|
public sort?: Array<Sort>;
|
|
1926
|
-
|
|
1949
|
+
public getAllRecords?: () => Array<Record> | undefined;
|
|
1950
|
+
private _records: Array<Record>;
|
|
1951
|
+
private _total?: number;
|
|
1952
|
+
|
|
1927
1953
|
constructor(records: Array<Record>, mode: SelectionMode = SelectionMode.SOME_RECORDS, total?:number, filters?: Array<Filter>, sort?: Array<Sort>){
|
|
1928
1954
|
this._records = records;
|
|
1929
1955
|
this._total = total;
|
|
@@ -1934,7 +1960,10 @@ export class SelectionInfo{
|
|
|
1934
1960
|
|
|
1935
1961
|
public get records(): Array<Record> | undefined{
|
|
1936
1962
|
if(this.isAllRecords()){
|
|
1937
|
-
|
|
1963
|
+
if(this.getAllRecords != undefined){
|
|
1964
|
+
return this.getAllRecords();
|
|
1965
|
+
}
|
|
1966
|
+
throw new Error("Erro interno: Impossível retornar os registros selecionados numa seleção virtual.");
|
|
1938
1967
|
}
|
|
1939
1968
|
return this._records;
|
|
1940
1969
|
}
|
|
@@ -1953,7 +1982,7 @@ export class SelectionInfo{
|
|
|
1953
1982
|
if(this.isAllRecords()){
|
|
1954
1983
|
return this._total || 0;
|
|
1955
1984
|
}
|
|
1956
|
-
return this.records == undefined ? 0: this.records.length;
|
|
1985
|
+
return this.records == undefined ? 0 : (this.records as Array<Record>).length;
|
|
1957
1986
|
}
|
|
1958
1987
|
|
|
1959
1988
|
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
|
}
|
|
@@ -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;
|
|
@@ -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
|
|