@sankhyalabs/core 5.20.0-dev.72 → 5.20.0-dev.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.docs/classes/Base64Utils.md +39 -0
  2. package/.docs/classes/Change.md +11 -11
  3. package/.docs/classes/DataUnit.md +122 -100
  4. package/.docs/classes/KeyboardManager.md +79 -9
  5. package/.docs/classes/SelectionInfo.md +12 -12
  6. package/.docs/classes/StringUtils.md +24 -0
  7. package/.docs/enumerations/ChangeOperation.md +4 -4
  8. package/.docs/enumerations/SelectionMode.md +2 -2
  9. package/.docs/globals.md +1 -0
  10. package/.docs/interfaces/DUActionInterceptor.md +1 -1
  11. package/.docs/interfaces/PageRequest.md +3 -3
  12. package/.docs/interfaces/QuickFilter.md +3 -3
  13. package/.docs/interfaces/Record.md +4 -4
  14. package/.docs/interfaces/SavedRecord.md +5 -5
  15. package/.docs/interfaces/WaitingChange.md +3 -3
  16. package/.docs/type-aliases/DataUnitEventOptions.md +1 -1
  17. package/dist/dataunit/DataUnit.d.ts +10 -1
  18. package/dist/dataunit/DataUnit.js +10 -4
  19. package/dist/dataunit/DataUnit.js.map +1 -1
  20. package/dist/index.d.ts +2 -1
  21. package/dist/index.js +2 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/utils/Base64Utils.d.ts +7 -0
  24. package/dist/utils/Base64Utils.js +13 -0
  25. package/dist/utils/Base64Utils.js.map +1 -0
  26. package/dist/utils/KeyboardManager/index.d.ts +4 -0
  27. package/dist/utils/KeyboardManager/index.js +37 -1
  28. package/dist/utils/KeyboardManager/index.js.map +1 -1
  29. package/dist/utils/KeyboardManager/interface.d.ts +1 -0
  30. package/dist/utils/StringUtils.d.ts +6 -0
  31. package/dist/utils/StringUtils.js +11 -0
  32. package/dist/utils/StringUtils.js.map +1 -1
  33. package/package.json +1 -1
  34. package/reports/test-report.xml +144 -144
  35. package/src/dataunit/DataUnit.ts +18 -4
  36. package/src/index.ts +4 -1
  37. package/src/utils/Base64Utils.ts +13 -0
  38. package/src/utils/KeyboardManager/index.ts +47 -0
  39. package/src/utils/KeyboardManager/interface.ts +1 -0
  40. package/src/utils/StringUtils.ts +13 -0
@@ -1,204 +1,173 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <unitTest version="1">
3
+ <file path="/builds/dti/design-system/sankhyacore/src/utils/test/objectUtils.spec.ts">
4
+ <testCase name="ObjectUtils hasEquivalentValues should return true if both objects have the same property value" duration="6"/>
5
+ <testCase name="ObjectUtils hasEquivalentValues should return false if both objects have different property values" duration="0"/>
6
+ <testCase name="ObjectUtils hasEquivalentValues should return true if both objects are equivalent with custom property to compare" duration="1"/>
7
+ <testCase name="ObjectUtils hasEquivalentValues should return false if both objects are not equivalent with custom property to compare" duration="1"/>
8
+ <testCase name="ObjectUtils hasEquivalentValues should return false if one object does not have the property" duration="1"/>
9
+ <testCase name="ObjectUtils hasEquivalentValues should return true if comparing primitive values directly" duration="1"/>
10
+ <testCase name="ObjectUtils hasEquivalentValues should return false if comparing different primitive values" duration="0"/>
11
+ <testCase name="ObjectUtils hasEquivalentValues should return true when comparing object with a null value" duration="1"/>
12
+ <testCase name="ObjectUtils hasEquivalentValues should return false when comparing object with null and non-null value" duration="0"/>
13
+ <testCase name="ObjectUtils hasEquivalentValues should return true when comparing non-object values that are equal" duration="1"/>
14
+ <testCase name="ObjectUtils should get an object value based on its path" duration="77"/>
15
+ <testCase name="ObjectUtils should get an object value based on its path" duration="1"/>
16
+ <testCase name="ObjectUtils should return undefined if the path doesn&apos;t exist in the object" duration="1"/>
17
+ </file>
3
18
  <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="86"/>
19
+ <testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="181"/>
5
20
  <testCase name="StringUtils it should modify &quot;expressions&quot; and &quot;parameters&quot; properties through Setters methods" duration="1"/>
6
21
  <testCase name="StringUtils it should return &quot;expression&quot; and &quot;parameters&quot; setted through constructor method" duration="1"/>
7
22
  <testCase name="StringUtils it should return a Criteria class with &quot;expression&quot; and &quot;parameters&quot; as needed setted through &quot;append&quot; method" duration="1"/>
8
- <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;append&quot; method" duration="1"/>
23
+ <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;append&quot; method" duration="2"/>
9
24
  <testCase name="StringUtils it should return undefined as &quot;expression&quot; and &quot;[]&quot; 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 &quot;Expression&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="1"/>
25
+ <testCase name="StringUtils it should return a Criteria class with &quot;Expression&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="94"/>
26
+ <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="1"/>
11
27
  <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="1"/>
12
- <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="65"/>
13
- <testCase name="StringUtils it should return a Criteria class with &quot;Expression&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="19"/>
14
- <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="74"/>
28
+ <testCase name="StringUtils it should return a Criteria class with &quot;Expression&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="3"/>
29
+ <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="1"/>
15
30
  <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="1"/>
16
31
  <testCase name="StringUtils it should return a toJSON object with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="1"/>
17
- <testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="0"/>
32
+ <testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="1"/>
33
+ </file>
34
+ <file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
35
+ <testCase name="HttpProvider Metodo GET" duration="0"/>
36
+ </file>
37
+ <file path="/builds/dti/design-system/sankhyacore/test/util/OverflowWatcher.spec.ts">
38
+ <testCase name="OverflowWatcher should initialize with provided parameters" duration="10"/>
39
+ <testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="3"/>
40
+ <testCase name="OverflowWatcher Should call callback on forceUpdate" duration="315"/>
41
+ <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="96"/>
42
+ <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="92"/>
43
+ <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="7"/>
44
+ <testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="3"/>
45
+ <testCase name="OverflowWatcher should ignore elements that can not overflow" duration="201"/>
46
+ <testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="1"/>
47
+ </file>
48
+ <file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
49
+ <testCase name="HttpProvider Metodo POST" duration="1"/>
18
50
  </file>
19
51
  <file path="/builds/dti/design-system/sankhyacore/test/util/MaskFormatter.spec.ts">
20
- <testCase name="Mask Formatter mask:CPF complete valid" duration="75"/>
52
+ <testCase name="Mask Formatter mask:CPF complete valid" duration="92"/>
21
53
  <testCase name="Mask Formatter mask:CPF complete valid literals" duration="1"/>
22
- <testCase name="Mask Formatter mask:CPF incomplete valid" duration="0"/>
54
+ <testCase name="Mask Formatter mask:CPF incomplete valid" duration="1"/>
23
55
  <testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="1"/>
24
56
  <testCase name="Mask Formatter mask:CPF too long valid" duration="1"/>
25
- <testCase name="Mask Formatter mask:CPF invalid for string" duration="200"/>
26
- <testCase name="Mask Formatter mask:CPF invalid for being too long" duration="1"/>
57
+ <testCase name="Mask Formatter mask:CPF invalid for string" duration="140"/>
58
+ <testCase name="Mask Formatter mask:CPF invalid for being too long" duration="0"/>
27
59
  <testCase name="Mask Formatter mask:Licence plate valid uppercase" duration="1"/>
28
60
  <testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="1"/>
29
- <testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
30
- <testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="0"/>
61
+ <testCase name="Mask Formatter mask:Licence plate invalid" duration="57"/>
62
+ <testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="1"/>
31
63
  <testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="0"/>
32
- <testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
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="1"/>
35
- <testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
64
+ <testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
36
65
  <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="1"/>
66
+ <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
38
67
  <testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
39
- <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="1"/>
68
+ <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
40
69
  <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
41
70
  <testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
42
- </file>
43
- <file path="/builds/dti/design-system/sankhyacore/test/util/NumberUtils.spec.ts">
44
- <testCase name="StringUtils stringToNumber" duration="12"/>
45
- <testCase name="StringUtils format" duration="82"/>
46
- <testCase name="StringUtils format without formatnumber parameter" duration="0"/>
47
- <testCase name="StringUtils format without formatnumber parameter" duration="1"/>
48
- <testCase name="StringUtils format round number" duration="2"/>
49
- </file>
50
- <file path="/builds/dti/design-system/sankhyacore/test/dataunit/loader/utils/dataUnitLoaderUtils.spec.ts">
51
- <testCase name="Utility Functions applyFilter should return the original records if no filters are provided" duration="11"/>
52
- <testCase name="Utility Functions applyFilter should filter records based on provided filters" duration="2"/>
53
- <testCase name="Utility Functions buildPaginationInfo function should return correct pagination info with default values" duration="1"/>
54
- <testCase name="Utility Functions buildPaginationInfo function should redosLenth as same size as recordsPerPage" duration="1"/>
55
- <testCase name="Utility Functions buildPaginationInfo function should handle case when totalRecordsLength and offset 0" duration="1"/>
56
- <testCase name="Utility Functions buildPaginationInfo function should handle case when currentPageLength is less than totalRecordsLength and lastPage" duration="8"/>
57
- <testCase name="Utility Functions applySorting function should return the original records if no sorting is provided" duration="1"/>
58
- <testCase name="Utility Functions applySorting function should sort records based on provided sorting criteria" duration="1"/>
59
- </file>
60
- <file path="/builds/dti/design-system/sankhyacore/test/util/OverflowWatcher.spec.ts">
61
- <testCase name="OverflowWatcher should initialize with provided parameters" duration="9"/>
62
- <testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="2"/>
63
- <testCase name="OverflowWatcher Should call callback on forceUpdate" duration="194"/>
64
- <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="97"/>
65
- <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="13"/>
66
- <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="9"/>
67
- <testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="4"/>
68
- <testCase name="OverflowWatcher should ignore elements that can not overflow" duration="19"/>
69
- <testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="70"/>
70
- </file>
71
- <file path="/builds/dti/design-system/sankhyacore/src/utils/test/objectUtils.spec.ts">
72
- <testCase name="ObjectUtils hasEquivalentValues should return true if both objects have the same property value" duration="1"/>
73
- <testCase name="ObjectUtils hasEquivalentValues should return false if both objects have different property values" duration="1"/>
74
- <testCase name="ObjectUtils hasEquivalentValues should return true if both objects are equivalent with custom property to compare" duration="0"/>
75
- <testCase name="ObjectUtils hasEquivalentValues should return false if both objects are not equivalent with custom property to compare" duration="1"/>
76
- <testCase name="ObjectUtils hasEquivalentValues should return false if one object does not have the property" duration="0"/>
77
- <testCase name="ObjectUtils hasEquivalentValues should return true if comparing primitive values directly" duration="1"/>
78
- <testCase name="ObjectUtils hasEquivalentValues should return false if comparing different primitive values" duration="0"/>
79
- <testCase name="ObjectUtils hasEquivalentValues should return true when comparing object with a null value" duration="0"/>
80
- <testCase name="ObjectUtils hasEquivalentValues should return false when comparing object with null and non-null value" duration="1"/>
81
- <testCase name="ObjectUtils hasEquivalentValues should return true when comparing non-object values that are equal" duration="0"/>
82
- <testCase name="ObjectUtils should get an object value based on its path" duration="1"/>
83
- <testCase name="ObjectUtils should get an object value based on its path" duration="0"/>
84
- <testCase name="ObjectUtils should return undefined if the path doesn&apos;t exist in the object" duration="1"/>
85
- </file>
86
- <file path="/builds/dti/design-system/sankhyacore/test/util/ColumnFilterManager.spec.ts">
87
- <testCase name="ColumnFilterManager getColumnFilters should return an empty map if filters are undefined or empty" duration="1"/>
88
- <testCase name="ColumnFilterManager getColumnFilters should return a map of filters matching the pattern and not the provided fieldName" duration="1"/>
89
- <testCase name="ColumnFilterManager getFilterFunction should return undefined if no filters are provided" duration="1"/>
90
- <testCase name="ColumnFilterManager getFilterFunction should return a function that evaluates records based on filters" duration="1"/>
91
- <testCase name="ColumnFilterManager getFilterFunction should return a function that evaluates records and return false" duration="0"/>
92
- <testCase name="ColumnFilterManager compileDistinct should return an array of distinct field values formatted correctly" duration="1"/>
93
- <testCase name="ColumnFilterManager compileDistinct should filter records if a load request is present" duration="1"/>
94
- </file>
95
- <file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
96
- <testCase name="HttpProvider Metodo GET" duration="1"/>
71
+ <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
72
+ <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
73
+ <testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
97
74
  </file>
98
75
  <file path="/builds/dti/design-system/sankhyacore/test/util/StringUtils.spec.ts">
99
- <testCase name="StringUtils valor vazio" duration="2"/>
100
- <testCase name="StringUtils valor em branco" duration="0"/>
101
- <testCase name="StringUtils valor null" duration="1"/>
76
+ <testCase name="StringUtils valor vazio" duration="107"/>
77
+ <testCase name="StringUtils valor em branco" duration="10"/>
78
+ <testCase name="StringUtils valor null" duration="0"/>
102
79
  <testCase name="StringUtils valor undefined" duration="0"/>
103
80
  <testCase name="StringUtils valor 0" duration="0"/>
104
81
  <testCase name="StringUtils com valor" duration="1"/>
105
82
  <testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="1"/>
106
- <testCase name="StringUtils should return the original value when called with an object without a toString method" duration="1"/>
83
+ <testCase name="StringUtils should return the original value when called with an object without a toString method" duration="83"/>
107
84
  <testCase name="StringUtils should return the original value when called with undefined" duration="1"/>
108
85
  </file>
109
- <file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
110
- <testCase name="HttpProvider Metodo POST" duration="0"/>
86
+ <file path="/builds/dti/design-system/sankhyacore/test/util/NumberUtils.spec.ts">
87
+ <testCase name="StringUtils stringToNumber" duration="183"/>
88
+ <testCase name="StringUtils format" duration="315"/>
89
+ <testCase name="StringUtils format without formatnumber parameter" duration="1"/>
90
+ <testCase name="StringUtils format without formatnumber parameter" duration="2"/>
91
+ <testCase name="StringUtils format round number" duration="1"/>
111
92
  </file>
112
93
  <file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
113
- <testCase name="StringUtils it should return the correct values of &quot;value&quot; and &quot;type&quot; through the getters methods initial setted by the constructor" duration="2"/>
114
- <testCase name="StringUtils it should return the correct values of &quot;value&quot; and &quot;type&quot; through the getters methods initial setted by the setters methods" duration="0"/>
115
- <testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="0"/>
94
+ <testCase name="StringUtils it should return the correct values of &quot;value&quot; and &quot;type&quot; through the getters methods initial setted by the constructor" duration="1"/>
95
+ <testCase name="StringUtils it should return the correct values of &quot;value&quot; and &quot;type&quot; through the getters methods initial setted by the setters methods" duration="4"/>
96
+ <testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="1"/>
116
97
  </file>
117
- <file path="/builds/dti/design-system/sankhyacore/src/dataunit/state/slice/test/RecordsSlice.spec.ts">
118
- <testCase name="RecordsSlice should return newlines at the end" duration="2"/>
98
+ <file path="/builds/dti/design-system/sankhyacore/test/util/ColumnFilterManager.spec.ts">
99
+ <testCase name="ColumnFilterManager getColumnFilters should return an empty map if filters are undefined or empty" duration="12"/>
100
+ <testCase name="ColumnFilterManager getColumnFilters should return a map of filters matching the pattern and not the provided fieldName" duration="0"/>
101
+ <testCase name="ColumnFilterManager getFilterFunction should return undefined if no filters are provided" duration="1"/>
102
+ <testCase name="ColumnFilterManager getFilterFunction should return a function that evaluates records based on filters" duration="3"/>
103
+ <testCase name="ColumnFilterManager getFilterFunction should return a function that evaluates records and return false" duration="1"/>
104
+ <testCase name="ColumnFilterManager compileDistinct should return an array of distinct field values formatted correctly" duration="2"/>
105
+ <testCase name="ColumnFilterManager compileDistinct should filter records if a load request is present" duration="2"/>
106
+ </file>
107
+ <file path="/builds/dti/design-system/sankhyacore/test/dataunit/loader/utils/dataUnitLoaderUtils.spec.ts">
108
+ <testCase name="Utility Functions applyFilter should return the original records if no filters are provided" duration="16"/>
109
+ <testCase name="Utility Functions applyFilter should filter records based on provided filters" duration="1"/>
110
+ <testCase name="Utility Functions buildPaginationInfo function should return correct pagination info with default values" duration="1"/>
111
+ <testCase name="Utility Functions buildPaginationInfo function should redosLenth as same size as recordsPerPage" duration="4"/>
112
+ <testCase name="Utility Functions buildPaginationInfo function should handle case when totalRecordsLength and offset 0" duration="1"/>
113
+ <testCase name="Utility Functions buildPaginationInfo function should handle case when currentPageLength is less than totalRecordsLength and lastPage" duration="1"/>
114
+ <testCase name="Utility Functions applySorting function should return the original records if no sorting is provided" duration="1"/>
115
+ <testCase name="Utility Functions applySorting function should sort records based on provided sorting criteria" duration="2"/>
119
116
  </file>
120
117
  <file path="/builds/dti/design-system/sankhyacore/test/util/TimeFormatter.spec.ts">
121
- <testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="1"/>
122
- <testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="0"/>
123
- <testCase name="TimeFormatter Case: validateTime" duration="2"/>
118
+ <testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="3"/>
119
+ <testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="1"/>
120
+ <testCase name="TimeFormatter Case: validateTime" duration="1"/>
121
+ </file>
122
+ <file path="/builds/dti/design-system/sankhyacore/src/dataunit/state/slice/test/RecordsSlice.spec.ts">
123
+ <testCase name="RecordsSlice should return newlines at the end" duration="2"/>
124
124
  </file>
125
125
  <file path="/builds/dti/design-system/sankhyacore/test/util/DataUnitStorage.spec.ts">
126
- <testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="3"/>
126
+ <testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="7"/>
127
127
  <testCase name="DataUnitStorage get should return the stored DataUnit instance from the DataUnitStorage" duration="1"/>
128
128
  <testCase name="DataUnitStorage get should return undefined if the DataUnit instance is not found in the DataUnitStorage" duration="1"/>
129
129
  <testCase name="DataUnitStorage remove should remove the specified DataUnit instance from the DataUnitStorage" duration="1"/>
130
- <testCase name="DataUnitStorage remove should remove the DataUnit instance with the specified name from the DataUnitStorage" duration="8"/>
131
- <testCase name="DataUnitStorage remove should not remove any DataUnit instance if the specified DataUnit instance or name is not found in the DataUnitStorage" duration="1"/>
130
+ <testCase name="DataUnitStorage remove should remove the DataUnit instance with the specified name from the DataUnitStorage" duration="1"/>
131
+ <testCase name="DataUnitStorage remove should not remove any DataUnit instance if the specified DataUnit instance or name is not found in the DataUnitStorage" duration="66"/>
132
132
  </file>
133
133
  <file path="/builds/dti/design-system/sankhyacore/test/util/ElementIDUtils.spec.ts">
134
- <testCase name="addIDInfo 1 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="40"/>
135
- <testCase name="addIDInfo 2 - should add data-element-id with valid id &quot;brComSankhyaFinCadMovimentacaofinanceira_snkApplication&quot;" duration="3"/>
136
- <testCase name="addIDInfo 3 - should add data-element-id with valid id &quot;movFinanceira_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="3"/>
137
- <testCase name="addIDInfo 4 - should add data-element-id with valid id &quot;meuID2_snkApplication&quot;" duration="2"/>
134
+ <testCase name="addIDInfo 1 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="90"/>
135
+ <testCase name="addIDInfo 2 - should add data-element-id with valid id &quot;brComSankhyaFinCadMovimentacaofinanceira_snkApplication&quot;" duration="2"/>
136
+ <testCase name="addIDInfo 3 - should add data-element-id with valid id &quot;movFinanceira_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="1"/>
137
+ <testCase name="addIDInfo 4 - should add data-element-id with valid id &quot;meuID2_snkApplication&quot;" duration="1"/>
138
138
  <testCase name="addIDInfo 5 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="1"/>
139
139
  <testCase name="addIDInfo 6 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="2"/>
140
- <testCase name="addIDInfo 7 - should add data-element-id with valid id &quot;componenteNameTest_snkApplication&quot;" duration="2"/>
141
- <testCase name="addIDInfo 8 - should add data-element-id with valid id &quot;componentLabel_snkApplication&quot;" duration="1"/>
142
- <testCase name="addIDInfo 9 - should add data-element-id with valid id &quot;dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="2"/>
143
- <testCase name="addIDInfo 10 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="14"/>
144
- <testCase name="addIDInfo 11 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira&quot;" duration="11"/>
140
+ <testCase name="addIDInfo 7 - should add data-element-id with valid id &quot;componenteNameTest_snkApplication&quot;" duration="3"/>
141
+ <testCase name="addIDInfo 8 - should add data-element-id with valid id &quot;componentLabel_snkApplication&quot;" duration="2"/>
142
+ <testCase name="addIDInfo 9 - should add data-element-id with valid id &quot;dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="1"/>
143
+ <testCase name="addIDInfo 10 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="70"/>
144
+ <testCase name="addIDInfo 11 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira&quot;" duration="1"/>
145
145
  <testCase name="addIDInfo 12 - should add data-element-id with valid id &quot;dataunitFinanceiro_movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
146
- <testCase name="addIDInfo 13 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira&quot;" duration="2"/>
147
- <testCase name="addIDInfo 14 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira&quot;" duration="58"/>
146
+ <testCase name="addIDInfo 13 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira&quot;" duration="1"/>
147
+ <testCase name="addIDInfo 14 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira&quot;" duration="2"/>
148
148
  <testCase name="addIDInfo 15 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIdTeste_snkApplication&quot;" duration="1"/>
149
149
  <testCase name="addIDInfo 16 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIdTeste_snkApplication&quot;" duration="1"/>
150
150
  <testCase name="addIDInfo 17 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
151
151
  <testCase name="addIDInfo 18 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
152
152
  <testCase name="addIDInfo 19 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
153
153
  <testCase name="addIDInfo 20 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
154
- <testCase name="addIDInfo 21 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
155
- <testCase name="addIDInfo 22 - should add data-element-id with valid id &quot;bancoObrigatorio_movimentacaoFinanceira&quot;" duration="13"/>
154
+ <testCase name="addIDInfo 21 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="4"/>
155
+ <testCase name="addIDInfo 22 - should add data-element-id with valid id &quot;bancoObrigatorio_movimentacaoFinanceira&quot;" duration="2"/>
156
156
  </file>
157
157
  <file path="/builds/dti/design-system/sankhyacore/src/dataunit/test/DataUnit.spec.ts">
158
158
  <testCase name="DataUnit should return false when not waiting to reload" duration="2"/>
159
- <testCase name="DataUnit should set waitingToReload to true" duration="1"/>
159
+ <testCase name="DataUnit should set waitingToReload to true" duration="0"/>
160
160
  <testCase name="DataUnit should set waitingToReload to false" duration="1"/>
161
161
  <testCase name="DataUnit should dispatch SAVING_CANCELED action with correct fields and recordId" duration="1"/>
162
162
  </file>
163
- <file path="/builds/dti/design-system/sankhyacore/test/dataunit/formatting/PrettyFormatter.spec.ts">
164
- <testCase name="getFormattedValue should return empty string when value is null" duration="6"/>
165
- <testCase name="getFormattedValue should return empty string when value is not an array" duration="1"/>
166
- <testCase name="getFormattedValue should return empty string when value is an empty array" duration="0"/>
167
- <testCase name="getFormattedValue should return file name when value is an array with one file object" duration="0"/>
168
- <testCase name="getFormattedValue should return file count when value is an array with multiple file objects" duration="1"/>
169
- <testCase name="getFormattedValue should return empty string for undefined file" duration="0"/>
170
- <testCase name="getFormattedValue should handle OBJECT type with value field" duration="1"/>
171
- <testCase name="getFormattedValue should return empty string when value is undefined" duration="0"/>
172
- <testCase name="getFormattedValue should return value as string when value is not an object" duration="0"/>
173
- <testCase name="getFormattedValue should return value.toString() when value is an object without value property" duration="1"/>
174
- <testCase name="getFormattedValue should handle BOOLEAN type" duration="0"/>
175
- <testCase name="getFormattedValue should format numbers correctly" duration="50"/>
176
- <testCase name="getFormattedValue should format dates correctly" duration="19"/>
177
- <testCase name="getFormattedValue should format times correctly" duration="1"/>
178
- <testCase name="getFormattedValue should format datetime correctly" duration="1"/>
179
- <testCase name="getFormattedValue should call toString with correct parameters" duration="0"/>
180
- <testCase name="getFormattedValue should handle undefined descriptor gracefully" duration="0"/>
181
- <testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and matching option" duration="0"/>
182
- <testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="1"/>
183
- <testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and value as object" duration="0"/>
184
- <testCase name="getFormattedValue should return empty string with OPTIONSELECTOR and value as null" duration="0"/>
185
- <testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and options as JSON string" duration="1"/>
186
- <testCase name="getFormattedValue should return value with OPTIONSELECTOR and options as empty array" duration="0"/>
187
- <testCase name="getFormattedValue should format masked values correctly" duration="7"/>
188
- </file>
189
- <file path="/builds/dti/design-system/sankhyacore/test/util/ElementUtils.spec.ts">
190
- <testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="90"/>
191
- <testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="14"/>
192
- <testCase name="calcMarginSize should threat values defined as zero" duration="4"/>
193
- </file>
194
163
  <file path="/builds/dti/design-system/sankhyacore/test/dataunit/loader/dataUnitInMemoryLoader.spec.ts">
195
- <testCase name="DataUnitInMemoryLoader - loadData should be called load data when auto load is true" duration="52"/>
196
- <testCase name="DataUnitInMemoryLoader - loadData should be called load data when auto load is undefined" duration="2"/>
164
+ <testCase name="DataUnitInMemoryLoader - loadData should be called load data when auto load is true" duration="77"/>
165
+ <testCase name="DataUnitInMemoryLoader - loadData should be called load data when auto load is undefined" duration="3"/>
197
166
  <testCase name="DataUnitInMemoryLoader - loadData should not be called load data when auto load is false" duration="1"/>
198
- <testCase name="DataUnitInMemoryLoader - loadData should be called load data when config is undefined" duration="2"/>
167
+ <testCase name="DataUnitInMemoryLoader - loadData should be called load data when config is undefined" duration="1"/>
199
168
  <testCase name="DataUnitInMemoryLoader - getConvertedValue should return the original string if descriptor is undefined" duration="1"/>
200
169
  <testCase name="DataUnitInMemoryLoader - getConvertedValue should return the original string if dataType is TEXT" duration="1"/>
201
- <testCase name="DataUnitInMemoryLoader - getConvertedValue should convert to boolean when dataType is BOOLEAN" duration="1"/>
170
+ <testCase name="DataUnitInMemoryLoader - getConvertedValue should convert to boolean when dataType is BOOLEAN" duration="0"/>
202
171
  <testCase name="DataUnitInMemoryLoader - getConvertedValue should convert to number when dataType is NUMBER" duration="1"/>
203
172
  <testCase name="DataUnitInMemoryLoader - getConvertedValue should parse JSON when dataType is OBJECT" duration="1"/>
204
173
  <testCase name="DataUnitInMemoryLoader - getConvertedValue should convert to date when dataType is DATE and format is ISO" duration="1"/>
@@ -206,10 +175,41 @@
206
175
  <testCase name="DataUnitInMemoryLoader - getConvertedValue should return the original string if no dataType matches" duration="1"/>
207
176
  <testCase name="DataUnitInMemoryLoader - removeLoader should resolve with the provided record IDs" duration="1"/>
208
177
  <testCase name="DataUnitInMemoryLoader - removeLoader should handle empty record ID array" duration="1"/>
209
- <testCase name="DataUnitInMemoryLoader - removeLoader should resolve the promise" duration="5"/>
210
- <testCase name="DataUnitInMemoryLoader - buildInitialRecords (indiretamente via set records) should build initial records and convert field values based on metadata" duration="3"/>
178
+ <testCase name="DataUnitInMemoryLoader - removeLoader should resolve the promise" duration="1"/>
179
+ <testCase name="DataUnitInMemoryLoader - buildInitialRecords (indiretamente via set records) should build initial records and convert field values based on metadata" duration="2"/>
211
180
  <testCase name="DataUnitInMemoryLoader - buildInitialRecords (indiretamente via set records) should generate unique IDs for records without &quot;__record__id__&quot;" duration="4"/>
212
- <testCase name="DataUnitInMemoryLoader - buildInitialRecords (indiretamente via set records) should leave fields untouched if no matching metadata exists" duration="2"/>
213
- <testCase name="DataUnitInMemoryLoader - buildInitialRecords (indiretamente via set records) should skip conversion for non-string field values" duration="1"/>
181
+ <testCase name="DataUnitInMemoryLoader - buildInitialRecords (indiretamente via set records) should leave fields untouched if no matching metadata exists" duration="4"/>
182
+ <testCase name="DataUnitInMemoryLoader - buildInitialRecords (indiretamente via set records) should skip conversion for non-string field values" duration="2"/>
183
+ </file>
184
+ <file path="/builds/dti/design-system/sankhyacore/test/dataunit/formatting/PrettyFormatter.spec.ts">
185
+ <testCase name="getFormattedValue should return empty string when value is null" duration="5"/>
186
+ <testCase name="getFormattedValue should return empty string when value is not an array" duration="1"/>
187
+ <testCase name="getFormattedValue should return empty string when value is an empty array" duration="0"/>
188
+ <testCase name="getFormattedValue should return file name when value is an array with one file object" duration="1"/>
189
+ <testCase name="getFormattedValue should return file count when value is an array with multiple file objects" duration="0"/>
190
+ <testCase name="getFormattedValue should return empty string for undefined file" duration="1"/>
191
+ <testCase name="getFormattedValue should handle OBJECT type with value field" duration="0"/>
192
+ <testCase name="getFormattedValue should return empty string when value is undefined" duration="1"/>
193
+ <testCase name="getFormattedValue should return value as string when value is not an object" duration="0"/>
194
+ <testCase name="getFormattedValue should return value.toString() when value is an object without value property" duration="1"/>
195
+ <testCase name="getFormattedValue should handle BOOLEAN type" duration="56"/>
196
+ <testCase name="getFormattedValue should format numbers correctly" duration="20"/>
197
+ <testCase name="getFormattedValue should format dates correctly" duration="11"/>
198
+ <testCase name="getFormattedValue should format times correctly" duration="1"/>
199
+ <testCase name="getFormattedValue should format datetime correctly" duration="0"/>
200
+ <testCase name="getFormattedValue should call toString with correct parameters" duration="0"/>
201
+ <testCase name="getFormattedValue should handle undefined descriptor gracefully" duration="1"/>
202
+ <testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and matching option" duration="1"/>
203
+ <testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="0"/>
204
+ <testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and value as object" duration="0"/>
205
+ <testCase name="getFormattedValue should return empty string with OPTIONSELECTOR and value as null" duration="1"/>
206
+ <testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and options as JSON string" duration="0"/>
207
+ <testCase name="getFormattedValue should return value with OPTIONSELECTOR and options as empty array" duration="1"/>
208
+ <testCase name="getFormattedValue should format masked values correctly" duration="8"/>
209
+ </file>
210
+ <file path="/builds/dti/design-system/sankhyacore/test/util/ElementUtils.spec.ts">
211
+ <testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="42"/>
212
+ <testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="4"/>
213
+ <testCase name="calcMarginSize should threat values defined as zero" duration="41"/>
214
214
  </file>
215
215
  </unitTest>
@@ -345,6 +345,10 @@ export default class DataUnit {
345
345
  }
346
346
  }
347
347
 
348
+ public async loadDataWithParams({source, keepSelection, selectFirstRecord, executionCtx, checkLastFilter, quickFilter}: LoadDataParams): Promise<LoadDataResponse> {
349
+ return await this.loadData(quickFilter, executionCtx, checkLastFilter, source, selectFirstRecord, keepSelection);
350
+ }
351
+
348
352
  /**
349
353
  *
350
354
  * Carrega os registros do DataUnit.
@@ -356,7 +360,7 @@ export default class DataUnit {
356
360
  * @returns - Registros requisitados.
357
361
  *
358
362
  */
359
- public async loadData(quickFilter?: QuickFilter, executionCtx?: ExecutionContext, checkLastFilter?: boolean, source?: string, selectFirstRecord?: boolean): Promise<LoadDataResponse> {
363
+ public async loadData(quickFilter?: QuickFilter, executionCtx?: ExecutionContext, checkLastFilter?: boolean, source?: string, selectFirstRecord?: boolean, keepSelection?: boolean): Promise<LoadDataResponse> {
360
364
 
361
365
  await this.processLoadingLockers();
362
366
 
@@ -372,7 +376,7 @@ export default class DataUnit {
372
376
  }
373
377
  }
374
378
 
375
- const loadDataRequest = this.getLoadDataRequest(quickFilter, source);
379
+ const loadDataRequest = this.getLoadDataRequest(quickFilter, source, keepSelection);
376
380
  return this.executeLoadData(loadDataRequest, executionCtx, checkLastFilter, selectFirstRecord);
377
381
  }
378
382
 
@@ -437,12 +441,13 @@ export default class DataUnit {
437
441
  return this.gotoPage(getCurrentPage(this._stateManager) - 1, executionCtx);
438
442
  }
439
443
 
440
- private getLoadDataRequest(quickFilter?: QuickFilter, source?: string): LoadDataRequest {
444
+ private getLoadDataRequest(quickFilter?: QuickFilter, source?: string, keepSelection?: boolean): LoadDataRequest {
441
445
  const request: LoadDataRequest = {
442
446
  filters: quickFilter?.filter ? [quickFilter.filter] : this.getFilters(),
443
447
  sort: this.getSort(),
444
448
  parentRecordId: this.getParentRecordId(),
445
- source
449
+ source,
450
+ keepSelection
446
451
  };
447
452
 
448
453
  if (quickFilter) {
@@ -1932,6 +1937,15 @@ export default class DataUnit {
1932
1937
 
1933
1938
  }
1934
1939
 
1940
+ export interface LoadDataParams {
1941
+ quickFilter?: QuickFilter;
1942
+ executionCtx?: ExecutionContext;
1943
+ checkLastFilter?: boolean;
1944
+ source?: string;
1945
+ selectFirstRecord?: boolean;
1946
+ keepSelection?: boolean
1947
+ }
1948
+
1935
1949
  export interface DUActionInterceptor {
1936
1950
  interceptAction(action: DataUnitAction): DataUnitAction | Promise<DataUnitAction>;
1937
1951
  }
package/src/index.ts CHANGED
@@ -49,6 +49,7 @@ import { DataUnitInMemoryLoader } from "./dataunit/loader/dataUnitInMemoryLoader
49
49
  import { DataUnitLoaderUtils, PaginationInfoBuilderParams } from "./dataunit/loader/utils/dataUnitLoaderUtils.js";
50
50
  import { ColumnFilterManager } from "./utils/ColumnFilterManager.js";
51
51
  import { DataUnitInMemoryLoaderConfig, RECORD_DATE_FORMAT } from "./dataunit/loader/DataUnitInMemoryLoaderConfig.js";
52
+ import Base64Utils from "./utils/Base64Utils.js";
52
53
 
53
54
  /*Classes públicas no pacote*/
54
55
  export {
@@ -133,5 +134,7 @@ export {
133
134
  PaginationInfoBuilderParams,
134
135
  ColumnFilterManager,
135
136
  DataUnitInMemoryLoaderConfig,
136
- RECORD_DATE_FORMAT
137
+ RECORD_DATE_FORMAT,
138
+ Base64Utils,
139
+
137
140
  };
@@ -0,0 +1,13 @@
1
+ export default class Base64Utils{
2
+ /**
3
+ * Adiciona caracteres de quebra de linha ao hash64 que representa o recordId do registro.
4
+ * @param base64String - id do registro
5
+ */
6
+ public static addBreakLineCharacters(base64String: string) {
7
+ const lineBreakPattern = /.{1,76}/g;
8
+ const result = base64String.match(lineBreakPattern)?.join('\n') ?? base64String;
9
+ return result.slice(0, 247) + '\n' + result.slice(247);
10
+ }
11
+
12
+
13
+ }
@@ -9,6 +9,7 @@ import { keyCodeEventValues } from "./keyCodes/index.js";
9
9
  */
10
10
  export class KeyboardManager {
11
11
  private _options: IKeyboardOptions;
12
+ private _shadowRoots: ShadowRoot [] = [];
12
13
  private _mappedElements: IKeyboardMappedKeysElements = {};
13
14
 
14
15
  /**
@@ -22,10 +23,48 @@ export class KeyboardManager {
22
23
  propagate: false,
23
24
  element: document.body,
24
25
  debounceTime: 0,
26
+ enableShadowDom: false,
25
27
  ...options
26
28
  }
29
+
30
+ if(this._options.enableShadowDom) {
31
+ this._shadowRoots = this.findAllNestedShadowRoots(this._options.element);
32
+ }
27
33
  }
28
34
 
35
+ private findAllNestedShadowRoots(element: HTMLElement | Element | ChildNode | Document , results: ShadowRoot [] = []): ShadowRoot [] {
36
+ if (!element) {
37
+ return results;
38
+ }
39
+
40
+ const shadowRoot = (element as HTMLElement)?.shadowRoot;
41
+ if (shadowRoot) {
42
+ results.push(shadowRoot);
43
+
44
+ shadowRoot.querySelectorAll("*").forEach((child) => {
45
+ this.findAllNestedShadowRoots(child, results);
46
+ });
47
+ }
48
+
49
+ element.childNodes.forEach((child) => {
50
+ this.findAllNestedShadowRoots(child, results);
51
+ });
52
+
53
+ return results;
54
+ }
55
+
56
+ private addEventListenerToNestedShadowRoots(event: 'keydown' | 'keyup', callback: VoidFunction) {
57
+ this._shadowRoots.forEach((shadowRoot) => {
58
+ shadowRoot.addEventListener(event, callback);
59
+ });
60
+ }
61
+
62
+ private removeEventListenerToNestedShadowRoots(event: 'keydown' | 'keyup', callback: VoidFunction) {
63
+ this._shadowRoots.forEach((shadowRoot) => {
64
+ shadowRoot.removeEventListener(event, callback);
65
+ });
66
+ }
67
+
29
68
  /**
30
69
  * Associa um evento de teclado com uma função
31
70
  *
@@ -61,6 +100,10 @@ export class KeyboardManager {
61
100
 
62
101
  bindOptions.element.addEventListener(bindOptions.type, debounceFunction);
63
102
 
103
+ if(bindOptions.enableShadowDom) {
104
+ this.addEventListenerToNestedShadowRoots(bindOptions.type, debounceFunction);
105
+ }
106
+
64
107
  return this;
65
108
  }
66
109
 
@@ -86,6 +129,10 @@ export class KeyboardManager {
86
129
 
87
130
  element.removeEventListener(type, callback);
88
131
 
132
+ if(unbindElement.options.enableShadowDom) {
133
+ this.removeEventListenerToNestedShadowRoots(type, callback);
134
+ }
135
+
89
136
  return this;
90
137
  }
91
138
 
@@ -1,6 +1,7 @@
1
1
  export interface IKeyboardOptions {
2
2
  type: 'keydown' | 'keyup',
3
3
  propagate: boolean,
4
+ enableShadowDom: boolean,
4
5
  element: HTMLElement | Document,
5
6
  debounceTime: number,
6
7
  description?: string,
@@ -538,4 +538,17 @@ export class StringUtils {
538
538
 
539
539
  return valueAux;
540
540
  }
541
+
542
+
543
+ /**
544
+ * Escapa caracteres especiais em uma string, usando sequencias de escape Unicode.
545
+ * @param str A string que deve sofrer alteração.
546
+ * @returns String com valores alterados.
547
+ */
548
+ public static escapeString(str: string): string {
549
+ // eslint-disable-next-line no-control-regex
550
+ return str.replace(/[\u0000-\u001F\u007F-\uFFFF<>=&"']/g, (char) => {
551
+ return "\\u" + char.charCodeAt(0).toString(16).padStart(4, "0");
552
+ });
553
+ }
541
554
  }