@antscorp/antsomi-ui 1.3.5-beta.994 → 1.3.5-beta.995

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.
@@ -57,6 +57,8 @@ export const CodeStructure = ({ initialData, onChange }) => {
57
57
  fieldKeyChange !== 'suffix' &&
58
58
  fieldKeyChange !== 'prefix' &&
59
59
  fieldKeyChange !== 'refillInterval' &&
60
+ fieldKeyChange !== 'refillThreshold' &&
61
+ fieldKeyChange !== 'refillUnit' &&
60
62
  fieldKeyChange !== 'separator';
61
63
  const isChangePrefix = fieldKeyChange === 'suffix' || fieldKeyChange === 'prefix' || fieldKeyChange === 'separator';
62
64
  if (isRelevantChangeMaxCode) {
@@ -80,8 +82,8 @@ export const CodeStructure = ({ initialData, onChange }) => {
80
82
  });
81
83
  };
82
84
  useEffect(() => {
83
- setCodeSample(generateRandomCodeWithConfig(form.getFieldsValue()));
84
- setMaxCodes(calculateTotalCodes(form.getFieldValue('alphabetLetters'), form.getFieldValue('digitalNumbers'), form.getFieldValue('characterType')));
85
+ setCodeSample(generateRandomCodeWithConfig(initialData));
86
+ setMaxCodes(calculateTotalCodes(initialData.alphabetLetters, initialData.digitalNumbers, initialData.characterType));
85
87
  }, [initialData]);
86
88
  useEffect(() => {
87
89
  form.setFieldsValue(initialData);
@@ -97,17 +99,17 @@ export const CodeStructure = ({ initialData, onChange }) => {
97
99
  } }) }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SEPARATOR, 'Separator'), name: "separator", children: _jsx(Select, { options: SEPARATOR_OPTIONS, style: { width: '180px' } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, 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, { required: true, name: "quantity", rules: [{ required: true }], 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' }, 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(Form.Item, { noStyle: true, shouldUpdate: true, children: ({ getFieldValue }) => {
98
100
  const refillUnit = getFieldValue('refillUnit');
99
101
  return (_jsx(Form.Item, { name: "refillThreshold", noStyle: true, rules: [
100
- { required: true, message: 'Field is required!' },
102
+ { required: true, message: '' },
101
103
  {
102
104
  validator: (_, value) => {
103
105
  if (refillUnit === RefillUnitType.PERCENT) {
104
106
  if (value < 1 || value > 100) {
105
- return Promise.reject(new Error('Must be between 1 and 100'));
107
+ return Promise.reject(new Error(''));
106
108
  }
107
109
  }
108
110
  else if (refillUnit === RefillUnitType.CODES) {
109
111
  if (value < 0) {
110
- return Promise.reject(new Error('Must be ≥ 0 codes'));
112
+ return Promise.reject(new Error(''));
111
113
  }
112
114
  }
113
115
  return Promise.resolve();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.994",
3
+ "version": "1.3.5-beta.995",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",