@antscorp/antsomi-ui 1.3.6-beta.7 → 1.3.6-beta.8
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.
|
@@ -29,10 +29,10 @@ export const CAPITALIZATION_OPTIONS = [
|
|
|
29
29
|
value: CapitalizationType.LOWERCASE,
|
|
30
30
|
label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP_LOW, 'lowercase'),
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
{
|
|
33
|
+
value: CapitalizationType.RANDOM,
|
|
34
|
+
label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_ORDER_RANDOM, 'Random'),
|
|
35
|
+
},
|
|
36
36
|
];
|
|
37
37
|
export const CHARACTER_ORDER_OPTIONS = [
|
|
38
38
|
{
|
|
@@ -14,6 +14,7 @@ export var CapitalizationType;
|
|
|
14
14
|
(function (CapitalizationType) {
|
|
15
15
|
CapitalizationType["UPPERCASE"] = "upper";
|
|
16
16
|
CapitalizationType["LOWERCASE"] = "lower";
|
|
17
|
+
CapitalizationType["RANDOM"] = "random";
|
|
17
18
|
})(CapitalizationType || (CapitalizationType = {}));
|
|
18
19
|
export var SeparatorType;
|
|
19
20
|
(function (SeparatorType) {
|
|
@@ -18,9 +18,11 @@ export const generateRandomCodeWithConfig = ({ characterType, digitalNumbers, al
|
|
|
18
18
|
else if (capitalization === CapitalizationType.LOWERCASE) {
|
|
19
19
|
letterPart = letterPart.toLowerCase();
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
else if (capitalization === CapitalizationType.RANDOM) {
|
|
22
|
+
letterPart = Array.from(letterPart)
|
|
23
|
+
.map(char => (Math.random() < 0.5 ? char.toUpperCase() : char.toLowerCase()))
|
|
24
|
+
.join('');
|
|
25
|
+
}
|
|
24
26
|
// Order characters
|
|
25
27
|
let finalCode = '';
|
|
26
28
|
if (characterOrder === CharacterOrderType.RANDOM) {
|