@antscorp/antsomi-ui 1.3.5-beta.988 → 1.3.5-beta.989
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/es/components/molecules/CodeStructure/CodeStructure.js +11 -5
- package/es/components/molecules/CodeStructure/index.d.ts +2 -0
- package/es/components/molecules/CodeStructure/index.js +1 -0
- package/es/components/molecules/CodeStructure/type.d.ts +10 -10
- package/es/components/molecules/CodeStructure/type.js +8 -8
- package/es/components/molecules/index.d.ts +1 -0
- package/es/components/molecules/index.js +1 -0
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ export const CodeStructure = ({ initialData, onChange }) => {
|
|
|
17
17
|
const [state, setState] = useImmer({
|
|
18
18
|
codeSample: '',
|
|
19
19
|
maxCodes: 0,
|
|
20
|
-
refillThreshold:
|
|
20
|
+
refillThreshold: 0,
|
|
21
21
|
refillInterval: 'auto',
|
|
22
22
|
refillUnit: 'codes',
|
|
23
23
|
codeWithPrefixAndSuffix: '',
|
|
@@ -50,10 +50,16 @@ export const CodeStructure = ({ initialData, onChange }) => {
|
|
|
50
50
|
});
|
|
51
51
|
}, [setState]);
|
|
52
52
|
const setRefillUnit = useCallback((value) => {
|
|
53
|
+
if (value === RefillUnitType.PERCENT) {
|
|
54
|
+
setRefillThreshold(1);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
setRefillThreshold(0);
|
|
58
|
+
}
|
|
53
59
|
setState(draft => {
|
|
54
60
|
draft.refillUnit = value;
|
|
55
61
|
});
|
|
56
|
-
}, [setState]);
|
|
62
|
+
}, [setState, setRefillThreshold]);
|
|
57
63
|
const updateFormValues = (data) => {
|
|
58
64
|
const allValues = form.getFieldsValue();
|
|
59
65
|
form.setFieldsValue(allValues);
|
|
@@ -86,7 +92,7 @@ export const CodeStructure = ({ initialData, onChange }) => {
|
|
|
86
92
|
}, [form]);
|
|
87
93
|
// Effects
|
|
88
94
|
useEffect(() => {
|
|
89
|
-
setRefillThreshold(initialData.refillThreshold ||
|
|
95
|
+
setRefillThreshold(initialData.refillThreshold || 0);
|
|
90
96
|
}, [initialData.refillThreshold, setRefillThreshold]);
|
|
91
97
|
useEffect(() => {
|
|
92
98
|
setRefillUnit(initialData.refillUnit || RefillUnitType.CODES);
|
|
@@ -105,7 +111,7 @@ export const CodeStructure = ({ initialData, onChange }) => {
|
|
|
105
111
|
useEffect(() => {
|
|
106
112
|
form.setFieldsValue(initialData);
|
|
107
113
|
}, [initialData, form]);
|
|
108
|
-
return (_jsx(CodeStructureWrapper, { children: _jsxs(Form, { form: form, layout: "horizontal", labelCol: { span: 8 }, colon: false, wrapperCol: { span: 16 }, labelAlign: "left", initialValues: initialData, onValuesChange: updateFormValues, children: [_jsx(Title, { level:
|
|
114
|
+
return (_jsx(CodeStructureWrapper, { children: _jsxs(Form, { form: form, layout: "horizontal", labelCol: { span: 8 }, colon: false, wrapperCol: { span: 16 }, labelAlign: "left", initialValues: initialData, onValuesChange: updateFormValues, children: [_jsx(Title, { level: 5, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE, 'Code Structure') }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_PREFIX, 'Prefix'), name: "prefix", children: _jsx(Input, { placeholder: "" }) }), _jsxs(Row, { children: [_jsx(Col, { span: 8, offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_INFIX, 'Infix') }), _jsx(Col, { span: 16, offset: 0, children: _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE, 'Character Type') }) }), _jsx(Form.Item, { name: "characterType", children: _jsx(Radio.Group, { options: CHARACTER_TYPE_OPTIONS }) })] }) })] }), _jsx(Row, { children: _jsx(Col, { offset: 8, children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { name: "digitalNumbers", children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '40px' } }) }), _jsx("div", { style: { marginBottom: '15px' }, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_DIG_NO, 'digital numbers') })] }) }) }), _jsx(Row, { children: _jsx(Col, { offset: 8, children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { name: "alphabetLetters", children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '40px' } }) }), _jsx("div", { style: { marginBottom: '15px' }, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_LET_NO, 'alphabet letters') })] }) }) }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 8, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP, 'Letters Capitalization') }) }), _jsx(Form.Item, { label: _jsx("span", { children: "\u00A0" }), name: "capitalization", children: _jsx(Radio.Group, { options: CAPITALIZATION_OPTIONS }) })] }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 8, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_ORDER, 'Character Order') }) }), _jsx(Form.Item, { label: _jsx("span", { children: "\u00A0" }), name: "characterOrder", children: _jsx(Radio.Group, { options: CHARACTER_ORDER_OPTIONS }) })] }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SUFFIX, 'Suffix'), name: "suffix", children: _jsx(Input, { placeholder: "" }) }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SEPARATOR, 'Separator'), name: "separator", children: _jsx(Select, { options: SEPARATOR_OPTIONS, style: { width: '50%' } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 8, children: _jsxs(Flex, { justify: "start", align: "center", gap: 5, children: [translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_QUANTITY, 'Quantity'), ' ', _jsx("span", { style: { color: 'red' }, children: "*" })] }) }), _jsx(Col, { children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { name: "quantity", children: _jsx(InputNumber, { min: 1, max: 10000 }) }), _jsx("div", { style: { marginBottom: '15px' }, children: "code(s) per time" })] }) })] }), _jsxs(Form.Item, { label: translate(translations._ACT_PREVIEW, 'Preview'), children: ["Maximum of ", _jsx("b", { children: maxCodes.toLocaleString() }), " codes (sample", ' ', generateCodeWithPrefixAndSuffix(codeSample, form.getFieldValue('prefix'), form.getFieldValue('suffix'), form.getFieldValue('separator')), ") to be generated"] }), _jsx(Title, { level: 5, children: "Code Refill" }), _jsx(Form.Item, { label: "Refill Interval", name: "refillInterval", children: _jsxs(Radio.Group, { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, onChange: e => {
|
|
109
115
|
e.preventDefault();
|
|
110
|
-
}, children: [_jsx(Radio, { value: "manual", children: "Manual refill only" }), _jsx(Radio, { value: "auto", children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Typography.Text, { style: { whiteSpace: 'nowrap' }, children: "Add codes when less than" }), _jsx(InputNumber, { min: 1, max:
|
|
116
|
+
}, children: [_jsx(Radio, { value: "manual", children: "Manual refill only" }), _jsx(Radio, { value: "auto", children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Typography.Text, { style: { whiteSpace: 'nowrap' }, children: "Add codes when less than" }), _jsx(InputNumber, { min: refillUnit === RefillUnitType.CODES ? 0 : 1, max: refillUnit === RefillUnitType.PERCENT ? 100 : undefined, style: { width: '63px' }, value: refillThreshold, onChange: value => setRefillThreshold(value || 1) }), _jsx(Select, { onClick: e => e.preventDefault(), value: refillUnit, onChange: setRefillUnit, options: REFILL_UNIT_OPTIONS, style: { width: '63px' } }), "remaining"] }) })] }) })] }) }));
|
|
111
117
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CodeStructure } from './CodeStructure';
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
export declare enum CharacterType {
|
|
2
|
-
DIGITS = "
|
|
2
|
+
DIGITS = "numbers",
|
|
3
3
|
LETTERS = "letters",
|
|
4
|
-
DIGIT_AND_LETTERS = "
|
|
4
|
+
DIGIT_AND_LETTERS = "both"
|
|
5
5
|
}
|
|
6
6
|
export declare enum CharacterOrderType {
|
|
7
7
|
RANDOM = "random",
|
|
8
|
-
LETTER_FIRST = "
|
|
9
|
-
NUMBER_FIRST = "
|
|
8
|
+
LETTER_FIRST = "letters_first",
|
|
9
|
+
NUMBER_FIRST = "numbers_first"
|
|
10
10
|
}
|
|
11
11
|
export declare enum CapitalizationType {
|
|
12
|
-
UPPERCASE = "
|
|
13
|
-
LOWERCASE = "
|
|
14
|
-
TITLE_CASE = "
|
|
12
|
+
UPPERCASE = "upper",
|
|
13
|
+
LOWERCASE = "lower",
|
|
14
|
+
TITLE_CASE = "title"
|
|
15
15
|
}
|
|
16
16
|
export declare enum SeparatorType {
|
|
17
17
|
HYPHEN = "hyphen",
|
|
18
|
-
UNDERSCORE = "
|
|
18
|
+
UNDERSCORE = "under_score",
|
|
19
19
|
DOT = "dot",
|
|
20
20
|
NONE = "none"
|
|
21
21
|
}
|
|
@@ -35,9 +35,9 @@ export interface CodeStructureData {
|
|
|
35
35
|
characterOrder: CharacterOrderType;
|
|
36
36
|
separator: SeparatorType;
|
|
37
37
|
quantity: number;
|
|
38
|
-
suffix
|
|
38
|
+
suffix?: string;
|
|
39
39
|
refillInterval: RefillType;
|
|
40
|
-
prefix
|
|
40
|
+
prefix?: string;
|
|
41
41
|
refillThreshold?: number;
|
|
42
42
|
refillUnit?: RefillUnitType;
|
|
43
43
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
export var CharacterType;
|
|
2
2
|
(function (CharacterType) {
|
|
3
|
-
CharacterType["DIGITS"] = "
|
|
3
|
+
CharacterType["DIGITS"] = "numbers";
|
|
4
4
|
CharacterType["LETTERS"] = "letters";
|
|
5
|
-
CharacterType["DIGIT_AND_LETTERS"] = "
|
|
5
|
+
CharacterType["DIGIT_AND_LETTERS"] = "both";
|
|
6
6
|
})(CharacterType || (CharacterType = {}));
|
|
7
7
|
export var CharacterOrderType;
|
|
8
8
|
(function (CharacterOrderType) {
|
|
9
9
|
CharacterOrderType["RANDOM"] = "random";
|
|
10
|
-
CharacterOrderType["LETTER_FIRST"] = "
|
|
11
|
-
CharacterOrderType["NUMBER_FIRST"] = "
|
|
10
|
+
CharacterOrderType["LETTER_FIRST"] = "letters_first";
|
|
11
|
+
CharacterOrderType["NUMBER_FIRST"] = "numbers_first";
|
|
12
12
|
})(CharacterOrderType || (CharacterOrderType = {}));
|
|
13
13
|
export var CapitalizationType;
|
|
14
14
|
(function (CapitalizationType) {
|
|
15
|
-
CapitalizationType["UPPERCASE"] = "
|
|
16
|
-
CapitalizationType["LOWERCASE"] = "
|
|
17
|
-
CapitalizationType["TITLE_CASE"] = "
|
|
15
|
+
CapitalizationType["UPPERCASE"] = "upper";
|
|
16
|
+
CapitalizationType["LOWERCASE"] = "lower";
|
|
17
|
+
CapitalizationType["TITLE_CASE"] = "title";
|
|
18
18
|
})(CapitalizationType || (CapitalizationType = {}));
|
|
19
19
|
export var SeparatorType;
|
|
20
20
|
(function (SeparatorType) {
|
|
21
21
|
SeparatorType["HYPHEN"] = "hyphen";
|
|
22
|
-
SeparatorType["UNDERSCORE"] = "
|
|
22
|
+
SeparatorType["UNDERSCORE"] = "under_score";
|
|
23
23
|
SeparatorType["DOT"] = "dot";
|
|
24
24
|
SeparatorType["NONE"] = "none";
|
|
25
25
|
})(SeparatorType || (SeparatorType = {}));
|
|
@@ -66,6 +66,7 @@ export * from './EmojiCollections';
|
|
|
66
66
|
export * from './EmojiPopover';
|
|
67
67
|
export * from './DisplayFormat';
|
|
68
68
|
export { default as InputSelectAttribute } from './InputSelectAttribute';
|
|
69
|
+
export * from './CodeStructure';
|
|
69
70
|
export { EditorScript } from './EditorScript';
|
|
70
71
|
export { EditorTab } from './EditorTab';
|
|
71
72
|
export { SelectAccount } from './SelectAccount';
|
|
@@ -66,6 +66,7 @@ export * from './EmojiCollections';
|
|
|
66
66
|
export * from './EmojiPopover';
|
|
67
67
|
export * from './DisplayFormat';
|
|
68
68
|
export { default as InputSelectAttribute } from './InputSelectAttribute';
|
|
69
|
+
export * from './CodeStructure';
|
|
69
70
|
export { EditorScript } from './EditorScript';
|
|
70
71
|
export { EditorTab } from './EditorTab';
|
|
71
72
|
export { SelectAccount } from './SelectAccount';
|