iglooform 2.5.9 → 2.5.12

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 (59) hide show
  1. package/es/form/element/index.js +8 -1
  2. package/es/form/elements.js +2 -1
  3. package/es/form/hstep/style/index.less +1 -6
  4. package/es/form/hsteps/index.js +13 -2
  5. package/es/form/hsteps/style/index.less +24 -2
  6. package/es/form/section/style/index.less +4 -0
  7. package/es/free-form/element/index.js +8 -1
  8. package/es/index.d.ts +1 -1
  9. package/es/index.js +1 -1
  10. package/es/input/index.d.ts +1 -0
  11. package/es/input/index.js +1 -0
  12. package/es/input/input-id.d.ts +6 -0
  13. package/es/input/input-id.js +112 -0
  14. package/es/input/input-number.js +71 -1
  15. package/es/input/phone-number.js +80 -20
  16. package/es/locale/en-US/messages.json +5 -0
  17. package/es/locale/format-message.js +2 -2
  18. package/es/locale/id-ID/messages.json +14 -9
  19. package/es/locale/locale-provider.js +2 -2
  20. package/es/locale/th-TH/messages.json +14 -9
  21. package/es/locale/vi-VN/messages.json +14 -9
  22. package/es/locale/zh-CN/messages.json +14 -9
  23. package/es/locale/zh-TW/messages.json +5 -0
  24. package/es/select/select.js +4 -4
  25. package/es/types.d.ts +4 -0
  26. package/es/upload/index.js +10 -8
  27. package/es/upload/style/index.less +2 -0
  28. package/es/upload-photo/index.d.ts +1 -0
  29. package/es/upload-photo/index.js +4 -0
  30. package/lib/form/element/index.js +8 -1
  31. package/lib/form/elements.js +1 -0
  32. package/lib/form/hstep/style/index.less +1 -6
  33. package/lib/form/hsteps/index.js +13 -2
  34. package/lib/form/hsteps/style/index.less +24 -2
  35. package/lib/form/section/style/index.less +4 -0
  36. package/lib/free-form/element/index.js +8 -1
  37. package/lib/index.d.ts +1 -1
  38. package/lib/index.js +7 -0
  39. package/lib/input/index.d.ts +1 -0
  40. package/lib/input/index.js +8 -0
  41. package/lib/input/input-id.d.ts +6 -0
  42. package/lib/input/input-id.js +127 -0
  43. package/lib/input/input-number.js +72 -1
  44. package/lib/input/phone-number.js +78 -18
  45. package/lib/locale/en-US/messages.json +5 -0
  46. package/lib/locale/format-message.js +2 -2
  47. package/lib/locale/id-ID/messages.json +14 -9
  48. package/lib/locale/locale-provider.js +2 -2
  49. package/lib/locale/th-TH/messages.json +14 -9
  50. package/lib/locale/vi-VN/messages.json +14 -9
  51. package/lib/locale/zh-CN/messages.json +14 -9
  52. package/lib/locale/zh-TW/messages.json +5 -0
  53. package/lib/select/select.js +4 -4
  54. package/lib/types.d.ts +4 -0
  55. package/lib/upload/index.js +10 -8
  56. package/lib/upload/style/index.less +2 -0
  57. package/lib/upload-photo/index.d.ts +1 -0
  58. package/lib/upload-photo/index.js +4 -0
  59. package/package.json +1 -1
@@ -162,9 +162,16 @@ var Element = function Element(_ref) {
162
162
 
163
163
  useEffect(function () {
164
164
  if (!formItemProps.name || preview || !formItemProps.copiedValue.copied) return;
165
+ var originalValue = form === null || form === void 0 ? void 0 : form.getFieldValue(formItemProps.name);
166
+ var value = formItemProps.copiedValue.value;
167
+
168
+ if (_typeof(originalValue) === 'object' && _typeof(value) === 'object') {
169
+ value = Object.assign(originalValue, formItemProps.copiedValue.value);
170
+ }
171
+
165
172
  form && form.setFields([{
166
173
  name: formItemProps.name,
167
- value: formItemProps.copiedValue.value,
174
+ value: value,
168
175
  errors: []
169
176
  }]);
170
177
  }, [formItemProps.copiedValue.value]);
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from 'react';
2
2
  import Button from '../button';
3
3
  import Radio, { RadioGroup, RadioGroupWithOther } from '../radio';
4
- import Input, { PhoneNumber, Amount, Email, Password, InputNumber, TextArea, InputDate, CreditCard, Otp, ExpiryDate } from '../input';
4
+ import Input, { PhoneNumber, Amount, Email, Password, InputNumber, TextArea, InputDate, CreditCard, Otp, ExpiryDate, InputId } from '../input';
5
5
  import DatePicker, { IglooBuddhistDatePicker as BuddhistDatePicker, IglooRangePicker as RangePicker, IglooWeekPicker as WeekPicker, IglooMonthPicker as MonthPicker } from '../date-picker';
6
6
  import Confirmation from '../confirmation';
7
7
  import { AttachedSelect as Select, TimeSelect } from '../select';
@@ -18,6 +18,7 @@ var elementMap = {
18
18
  PhoneNumber: PhoneNumber,
19
19
  Amount: Amount,
20
20
  InputNumber: InputNumber,
21
+ InputId: InputId,
21
22
  TextArea: TextArea,
22
23
  DatePicker: DatePicker,
23
24
  CreditCard: CreditCard,
@@ -47,6 +47,7 @@
47
47
  .igloo-hstep-container {
48
48
  width: 100%;
49
49
  padding: 24px 16px;
50
+ margin-top: 0;
50
51
 
51
52
  .igloo-hstep-content {
52
53
  margin-top: 24px;
@@ -59,12 +60,6 @@
59
60
  margin-left: 16px;
60
61
  margin-right: 16px;
61
62
  }
62
-
63
- .igloo-hstep-label {
64
- margin-bottom: 8px;
65
- font-size: 16px;
66
- line-height: 24px;
67
- }
68
63
  }
69
64
 
70
65
  .igloo-hstep-button-container {
@@ -234,6 +234,13 @@ var HSteps = function HSteps(_ref) {
234
234
  'igloo-hsteps-bar-item': true,
235
235
  'igloo-hsteps-bar-item-current': index === current
236
236
  }),
237
+ style: {
238
+ cursor: index < current ? 'pointer' : 'default'
239
+ },
240
+ onClick: function onClick() {
241
+ if (index >= current) return;
242
+ setCurrent(index);
243
+ },
237
244
  children: [index < current && _jsx(SuccessFilled, {
238
245
  className: 'igloo-hsteps-bar-item-icon'
239
246
  }), _jsx(Typography, {
@@ -279,6 +286,10 @@ var HSteps = function HSteps(_ref) {
279
286
  children: [withReview && !md && _jsxs(Typography, {
280
287
  className: "igloo-hstep-label",
281
288
  level: "h3a",
289
+ style: {
290
+ display: 'flex',
291
+ justifyContent: 'space-between'
292
+ },
282
293
  children: [_jsx("span", {
283
294
  className: "igloo-hstep-label-text",
284
295
  children: formatMessage({
@@ -302,8 +313,8 @@ var HSteps = function HSteps(_ref) {
302
313
  }, (step === null || step === void 0 ? void 0 : step.key) || (step === null || step === void 0 ? void 0 : step.name));
303
314
  }), _jsxs("div", {
304
315
  className: "igloo-hsteps-confirmation",
305
- children: [md && _jsx(Typography, {
306
- level: "h3a",
316
+ children: [_jsx(Typography, {
317
+ level: md ? 'h3a' : 'h4',
307
318
  wrapElement: "div",
308
319
  children: formatMessage({
309
320
  id: 'Review and Submit'
@@ -55,8 +55,30 @@
55
55
  .igloo-hsteps-content {
56
56
  width: 100%;
57
57
 
58
- .igloo-hsteps-confirmation {
59
- padding: 16px;
58
+ .igloo-hsteps-confirmation-container {
59
+ background: #ffffff;
60
+ padding: 24px 16px;
61
+
62
+ .igloo-hsteps-confirmation {
63
+ padding: 16px;
64
+ margin-top: 8px;
65
+ }
66
+
67
+ .igloo-hstep-container {
68
+ width: 100%;
69
+ padding: 16px;
70
+ border-radius: 10px;
71
+
72
+ &:not(:first-child) {
73
+ margin-top: 24px;
74
+ }
75
+
76
+ .igloo-hstep-label {
77
+ margin-bottom: 8px;
78
+ font-size: 16px;
79
+ line-height: 24px;
80
+ }
81
+ }
60
82
  }
61
83
  }
62
84
 
@@ -11,6 +11,10 @@
11
11
  margin-top: 16px;
12
12
  }
13
13
 
14
+ .igloo-section-collapse-divider {
15
+ margin-bottom: 0;
16
+ }
17
+
14
18
  &:last-child {
15
19
  .igloo-section-collapse-divider {
16
20
  display: none;
@@ -156,9 +156,16 @@ var Element = function Element(props) {
156
156
 
157
157
  useEffect(function () {
158
158
  if (!formItemProps.name || preview || !formItemProps.copiedValue.copied) return;
159
+ var originalValue = form === null || form === void 0 ? void 0 : form.getFieldValue(formItemProps.name);
160
+ var value = formItemProps.copiedValue.value;
161
+
162
+ if (_typeof(originalValue) === 'object' && _typeof(value) === 'object') {
163
+ value = Object.assign(originalValue, formItemProps.copiedValue.value);
164
+ }
165
+
159
166
  form && form.setFields([{
160
167
  name: formItemProps.name,
161
- value: formItemProps.copiedValue.value,
168
+ value: value,
162
169
  errors: []
163
170
  }]);
164
171
  }, [formItemProps.copiedValue.value]);
package/es/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { default as Form } from './form';
2
2
  export { default as Button, GreenButton, YellowButton, RedButton, } from './button';
3
3
  export { default as DatePicker, IglooBuddhistDatePicker as BuddhistDatePicker, IglooRangePicker as RangePicker, IglooWeekPicker as WeekPicker, IglooMonthPicker as MonthPicker, } from './date-picker';
4
- export { default as Input, PhoneNumber, Amount, Password, Email, InputNumber, TextArea, InputDate, CreditCard, ExpiryDate, } from './input';
4
+ export { default as Input, PhoneNumber, Amount, Password, Email, InputNumber, TextArea, InputDate, CreditCard, ExpiryDate, InputId, } from './input';
5
5
  export { default as Select, TimeSelect, AttachedSelect } from './select';
6
6
  export { default as Radio, RadioGroup, RadioGroupWithOther } from './radio';
7
7
  export { default as Example } from './example';
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { default as Form } from './form';
2
2
  export { default as Button, GreenButton, YellowButton, RedButton } from './button';
3
3
  export { default as DatePicker, IglooBuddhistDatePicker as BuddhistDatePicker, IglooRangePicker as RangePicker, IglooWeekPicker as WeekPicker, IglooMonthPicker as MonthPicker } from './date-picker';
4
- export { default as Input, PhoneNumber, Amount, Password, Email, InputNumber, TextArea, InputDate, CreditCard, ExpiryDate } from './input';
4
+ export { default as Input, PhoneNumber, Amount, Password, Email, InputNumber, TextArea, InputDate, CreditCard, ExpiryDate, InputId } from './input';
5
5
  export { default as Select, TimeSelect, AttachedSelect } from './select';
6
6
  export { default as Radio, RadioGroup, RadioGroupWithOther } from './radio';
7
7
  export { default as Example } from './example';
@@ -8,5 +8,6 @@ export { default as InputDate } from './input-date';
8
8
  export { default as CreditCard } from './credit-card';
9
9
  export { default as Otp } from './otp';
10
10
  export { default as ExpiryDate } from './expiry-date';
11
+ export { default as InputId } from './input-id';
11
12
  import IglooInput from './input';
12
13
  export default IglooInput;
package/es/input/index.js CHANGED
@@ -8,5 +8,6 @@ export { default as InputDate } from './input-date';
8
8
  export { default as CreditCard } from './credit-card';
9
9
  export { default as Otp } from './otp';
10
10
  export { default as ExpiryDate } from './expiry-date';
11
+ export { default as InputId } from './input-id';
11
12
  import IglooInput from './input';
12
13
  export default IglooInput;
@@ -0,0 +1,6 @@
1
+ import { InputProps } from 'antd/es/input';
2
+ import { FC, IglooComponentProps } from '../types';
3
+ import './style/index.less';
4
+ declare type Props = InputProps & IglooComponentProps;
5
+ declare const InputId: FC<Props>;
6
+ export default InputId;
@@ -0,0 +1,112 @@
1
+ import "antd/es/input/style";
2
+ import _Input from "antd/es/input";
3
+
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
+
8
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import omit from 'omit.js';
12
+ import formMethods from '../utils/form-methods';
13
+ import { staticFormatMessage as formatMessage } from '../locale';
14
+ import './style/index.less';
15
+
16
+ var InputId = function InputId(props) {
17
+ return _jsx(_Input, _objectSpread(_objectSpread({
18
+ className: "igloo-input"
19
+ }, omit(props, formMethods)), {}, {
20
+ type: "number"
21
+ }));
22
+ };
23
+
24
+ InputId.formItemPropsHandler = function (config) {
25
+ var length = config.length,
26
+ maxLength = config.maxLength,
27
+ minLength = config.minLength,
28
+ label = config.label,
29
+ idType = config.idType;
30
+ var rules = [];
31
+
32
+ if (length !== undefined) {
33
+ rules.push({
34
+ validator: function validator(_, value) {
35
+ if (value === undefined || value === null || String(value).length === length) return Promise.resolve();
36
+ return Promise.reject(formatMessage({
37
+ id: '{label} must be {length} digits.',
38
+ values: {
39
+ length: length,
40
+ label: label
41
+ }
42
+ }));
43
+ }
44
+ });
45
+ }
46
+
47
+ if (maxLength !== undefined && minLength !== undefined) {
48
+ rules.push({
49
+ validator: function validator(_, value) {
50
+ if (value === undefined || value === null || String(value).length >= minLength && String(value).length <= maxLength) return Promise.resolve();
51
+ return Promise.reject(formatMessage({
52
+ id: '{label} must be {minLength} - {maxLength} digits.',
53
+ values: {
54
+ maxLength: maxLength,
55
+ minLength: minLength,
56
+ label: label
57
+ }
58
+ }));
59
+ }
60
+ });
61
+ }
62
+
63
+ if (maxLength !== undefined && minLength === undefined) {
64
+ rules.push({
65
+ validator: function validator(_, value) {
66
+ if (value === undefined || value === null || String(value).length <= maxLength) return Promise.resolve();
67
+ return Promise.reject(formatMessage({
68
+ id: '{label} must be less than {maxLength} digits.',
69
+ values: {
70
+ maxLength: maxLength,
71
+ label: label
72
+ }
73
+ }));
74
+ }
75
+ });
76
+ }
77
+
78
+ if (maxLength === undefined && minLength !== undefined) {
79
+ rules.push({
80
+ validator: function validator(_, value) {
81
+ if (value === undefined || value === null || String(value).length >= minLength) return Promise.resolve();
82
+ return Promise.reject(formatMessage({
83
+ id: '{label} must be at least {minLength} digits.',
84
+ values: {
85
+ minLength: minLength,
86
+ label: label
87
+ }
88
+ }));
89
+ }
90
+ });
91
+ }
92
+
93
+ if (idType === 'KTP') {
94
+ rules.push({
95
+ validator: function validator(rule, value) {
96
+ if (!/^((1[1-9])|(21)|([37][1-6])|(5[1-4])|(6[1-5])|([8-9][1-2]))[0-9]{4}(([0-6][0-9])|(7[0-1]))((0[1-9])|(1[0-2]))[0-9]{6}$/.test(value)) {
97
+ return Promise.reject(formatMessage({
98
+ id: 'Invalid KTP Number.'
99
+ }));
100
+ }
101
+
102
+ return Promise.resolve();
103
+ }
104
+ });
105
+ }
106
+
107
+ return {
108
+ rules: rules
109
+ };
110
+ };
111
+
112
+ export default InputId;
@@ -10,6 +10,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import omit from 'omit.js';
12
12
  import formMethods from '../utils/form-methods';
13
+ import { staticFormatMessage } from '../locale';
13
14
  import './style/index.less';
14
15
 
15
16
  var IglooInputNumber = function IglooInputNumber(props) {
@@ -39,6 +40,74 @@ var IglooInputNumber = function IglooInputNumber(props) {
39
40
  };
40
41
 
41
42
  IglooInputNumber.formItemPropsHandler = function (config) {
43
+ var length = config.length,
44
+ maxLength = config.maxLength,
45
+ minLength = config.minLength,
46
+ label = config.label,
47
+ idType = config.idType;
48
+ var rules = [];
49
+
50
+ if (length !== undefined) {
51
+ rules.push({
52
+ validator: function validator(_, value) {
53
+ if (value === undefined || value === null || String(value).length === length) return Promise.resolve();
54
+ return Promise.reject(staticFormatMessage({
55
+ id: '{label} must be {length} digits.',
56
+ values: {
57
+ length: length,
58
+ label: label
59
+ }
60
+ }));
61
+ }
62
+ });
63
+ }
64
+
65
+ if (maxLength !== undefined && minLength !== undefined) {
66
+ rules.push({
67
+ validator: function validator(_, value) {
68
+ if (value === undefined || value === null || String(value).length >= minLength && String(value).length <= maxLength) return Promise.resolve();
69
+ return Promise.reject(staticFormatMessage({
70
+ id: '{label} must be {minLength} - {maxLength} digits.',
71
+ values: {
72
+ maxLength: maxLength,
73
+ minLength: minLength,
74
+ label: label
75
+ }
76
+ }));
77
+ }
78
+ });
79
+ }
80
+
81
+ if (maxLength !== undefined && minLength === undefined) {
82
+ rules.push({
83
+ validator: function validator(_, value) {
84
+ if (value === undefined || value === null || String(value).length <= maxLength) return Promise.resolve();
85
+ return Promise.reject(staticFormatMessage({
86
+ id: '{label} must be less than {maxLength} digits.',
87
+ values: {
88
+ maxLength: maxLength,
89
+ label: label
90
+ }
91
+ }));
92
+ }
93
+ });
94
+ }
95
+
96
+ if (maxLength === undefined && minLength !== undefined) {
97
+ rules.push({
98
+ validator: function validator(_, value) {
99
+ if (value === undefined || value === null || String(value).length >= minLength) return Promise.resolve();
100
+ return Promise.reject(staticFormatMessage({
101
+ id: '{label} must be at least {minLength} digits.',
102
+ values: {
103
+ minLength: minLength,
104
+ label: label
105
+ }
106
+ }));
107
+ }
108
+ });
109
+ }
110
+
42
111
  return {
43
112
  getValueFromEvent: function getValueFromEvent(e) {
44
113
  var value = e.target.value;
@@ -49,7 +118,8 @@ IglooInputNumber.formItemPropsHandler = function (config) {
49
118
  }
50
119
 
51
120
  return str ? parseFloat(str) : undefined;
52
- }
121
+ },
122
+ rules: rules
53
123
  };
54
124
  };
55
125
 
@@ -14,11 +14,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
14
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
15
 
16
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- import { useState, useContext, useEffect } from 'react';
17
+ import { useState, useEffect } from 'react';
18
18
  import classnames from 'classnames';
19
19
  import invariant from 'invariant';
20
20
  import Select from '../select';
21
- import { staticFormatMessage, LocaleContext } from '../locale';
21
+ import { staticFormatMessage as formatMessage } from '../locale';
22
22
  import './style/index';
23
23
 
24
24
  var PhoneNumber = function PhoneNumber(_ref) {
@@ -29,13 +29,6 @@ var PhoneNumber = function PhoneNumber(_ref) {
29
29
  value = _ref.value,
30
30
  formChangeProps = _ref.onChange,
31
31
  style = _ref.style;
32
-
33
- var _useContext = useContext(LocaleContext),
34
- formatMessage = _useContext.formatMessage;
35
-
36
- formatMessage({
37
- id: 'Numbers only, please omit " " or "-".'
38
- });
39
32
  invariant(Array.isArray(areaCode) ? areaCode.length : true, 'areaCode cant be an empty array');
40
33
  invariant(areaCode != undefined, 'areaCode must be set');
41
34
 
@@ -95,22 +88,89 @@ var PhoneNumber = function PhoneNumber(_ref) {
95
88
 
96
89
  PhoneNumber.formItemPropsHandler = function (_ref2) {
97
90
  var areaCode = _ref2.areaCode,
98
- phoneNumber = _ref2.phoneNumber;
91
+ phoneNumber = _ref2.phoneNumber,
92
+ length = _ref2.length,
93
+ maxLength = _ref2.maxLength,
94
+ minLength = _ref2.minLength,
95
+ label = _ref2.label;
96
+ var rules = [{
97
+ validator: function validator(rule, value) {
98
+ if (!value) return Promise.resolve();
99
+ var phoneNumber = value.phoneNumber;
100
+ var pattern = /^[0-9]*$/;
101
+ return pattern.test(phoneNumber) ? Promise.resolve() : Promise.reject(formatMessage({
102
+ id: 'Numbers only, please omit " " or "-".'
103
+ }));
104
+ }
105
+ }];
106
+
107
+ if (length !== undefined) {
108
+ rules.push({
109
+ validator: function validator(_, value) {
110
+ if (value === undefined || value === null || value.phoneNumber.length === length) return Promise.resolve();
111
+ return Promise.reject(formatMessage({
112
+ id: '{label} must be {length} digits.',
113
+ values: {
114
+ length: length,
115
+ label: label
116
+ }
117
+ }));
118
+ }
119
+ });
120
+ }
121
+
122
+ if (maxLength !== undefined && minLength !== undefined) {
123
+ rules.push({
124
+ validator: function validator(_, value) {
125
+ if (value === undefined || value === null || value.phoneNumber.length >= minLength && value.phoneNumber.length <= maxLength) return Promise.resolve();
126
+ return Promise.reject(formatMessage({
127
+ id: '{label} must be {minLength} - {maxLength} digits.',
128
+ values: {
129
+ maxLength: maxLength,
130
+ minLength: minLength,
131
+ label: label
132
+ }
133
+ }));
134
+ }
135
+ });
136
+ }
137
+
138
+ if (maxLength !== undefined && minLength === undefined) {
139
+ rules.push({
140
+ validator: function validator(_, value) {
141
+ if (value === undefined || value === null || value.phoneNumber.length <= maxLength) return Promise.resolve();
142
+ return Promise.reject(formatMessage({
143
+ id: '{label} must be less than {maxLength} digits.',
144
+ values: {
145
+ maxLength: maxLength,
146
+ label: label
147
+ }
148
+ }));
149
+ }
150
+ });
151
+ }
152
+
153
+ if (maxLength === undefined && minLength !== undefined) {
154
+ rules.push({
155
+ validator: function validator(_, value) {
156
+ if (value === undefined || value === null || value.phoneNumber.length >= minLength) return Promise.resolve();
157
+ return Promise.reject(formatMessage({
158
+ id: '{label} must be at least {minLength} digits.',
159
+ values: {
160
+ minLength: minLength,
161
+ label: label
162
+ }
163
+ }));
164
+ }
165
+ });
166
+ }
167
+
99
168
  return {
100
169
  initialValue: phoneNumber ? {
101
170
  areaCode: Array.isArray(areaCode) ? areaCode[0] : areaCode,
102
171
  phoneNumber: phoneNumber
103
172
  } : undefined,
104
- rules: [{
105
- validator: function validator(rule, value) {
106
- if (!value) return Promise.resolve();
107
- var phoneNumber = value.phoneNumber;
108
- var pattern = /^[0-9]*$/;
109
- return pattern.test(phoneNumber) ? Promise.resolve() : Promise.reject(staticFormatMessage({
110
- id: 'Numbers only, please omit " " or "-".'
111
- }));
112
- }
113
- }],
173
+ rules: rules,
114
174
  previewFormater: function previewFormater(_ref3) {
115
175
  var areaCode = _ref3.areaCode,
116
176
  phoneNumber = _ref3.phoneNumber;
@@ -29,6 +29,7 @@
29
29
  "I agree to the Igloo": "I agree to the Igloo",
30
30
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.",
31
31
  "Import": "Import",
32
+ "Invalid KTP Number.": "Invalid KTP Number.",
32
33
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.",
33
34
  "Last 7 Days": "Last 7 Days",
34
35
  "Last Day": "Last Day",
@@ -86,5 +87,9 @@
86
87
  "{count} files attached.": "{count} files attached.",
87
88
  "{currentStep} of {allSteps}": "{currentStep} of {allSteps}",
88
89
  "{doneNumber} files imported.": "{doneNumber} files imported.",
90
+ "{label} must be at least {minLength} digits.": "{label} must be at least {minLength} digits.",
91
+ "{label} must be less than {maxLength} digits.": "{label} must be less than {maxLength} digits.",
92
+ "{label} must be {length} digits.": "{label} must be {length} digits.",
93
+ "{label} must be {minLength} - {maxLength} digits.": "{label} must be {minLength} - {maxLength} digits.",
89
94
  "{processingNumber} files in progress...": "{processingNumber} files in progress..."
90
95
  }
@@ -9,10 +9,10 @@ var formatMessage = function formatMessage(props) {
9
9
  values = props.values;
10
10
 
11
11
  if (!values || !Object.keys(values).length) {
12
- return locale[id];
12
+ return locale[id] || id;
13
13
  }
14
14
 
15
- return locale[id].replaceAll(/\{(.+?)\}/g, function (_, name) {
15
+ return (locale[id] || id).replaceAll(/\{(.+?)\}/g, function (_, name) {
16
16
  return values[name];
17
17
  });
18
18
  };
@@ -26,9 +26,10 @@
26
26
  "Edit": "Ubah",
27
27
  "Error Report": "Laporan Kesalahan",
28
28
  "Filter": "Saring",
29
- "I agree to the Igloo": "",
29
+ "I agree to the Igloo": "Saya setuju dengan Igloo",
30
30
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "Saya menyatakan bahwa pernyataan yang saya jelaskan di atas adalah benar. Selanjutnya saya nyatakan bahwa kerugian yang terjadi merupakan ketidaksengajaan, dan terjadi tanpa perencanaan atau hasil musyawarah dengan pihak lain.",
31
31
  "Import": "Impor",
32
+ "Invalid KTP Number.": "Số KTP không hợp lệ.",
32
33
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Direkomendasikan untuk memilih tidak lebih dari {colMax} metrik untuk memastikan sudut pandang default dari setiap isi kolom.",
33
34
  "Last 7 Days": "7 hari terakhir",
34
35
  "Last Day": "hari terakhir",
@@ -38,20 +39,20 @@
38
39
  "No preview for this file. Only support image, video or PDF file.": "Tidak ada pratinjau untuk file ini. Hanya mendukung file gambar, video atau PDF.",
39
40
  "Numbers only, please omit \" \" or \"-\".": "Angka saja, harap hilangkan \" \" atau \"-\".",
40
41
  "OK": "oke",
41
- "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "",
42
+ "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "Setelah Anda puas dengan hal di atas, dan Anda telah mencentang kotak di bawah, silakan lanjutkan dan kirimkan aktivasi Anda.",
42
43
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "Jika Anda puas dengan apa yang telah disampaikan, dan Anda telah memeriksa deklarasi tersebut, silakan lanjutkan dan ajukan klaim Anda.",
43
44
  "Optional": "Pilihan",
44
45
  "Other Reason": "Alasan lain",
45
46
  "Please enter a valid date.": "Silakan tulis tanggal valid",
46
47
  "Please enter a valid time.": "Harap masukkan waktu yang valid",
47
- "Please input a date after {date}": "",
48
- "Please input a date before {date}": "",
49
- "Please read and agree to Igloo Terms of Use and Privacy Policy": "",
48
+ "Please input a date after {date}": "Harap masukkan tanggal setelah {date}",
49
+ "Please input a date before {date}": "Harap masukkan tanggal sebelum {date}",
50
+ "Please read and agree to Igloo Terms of Use and Privacy Policy": "Harap baca dan setujui Persyaratan Penggunaan dan Kebijakan Privasi Igloo",
50
51
  "Please select": "Silahkan pilih",
51
52
  "Please select a file type": "Silakan pilih tipe dokumen",
52
53
  "Please take a moment to review what you’ve told us above.": "Mohon luangkan waktu sejenak untuk meninjau ulang seluruh data yang Anda telah sampaikan sebelumnya .",
53
54
  "Previous": "Sebelumnya",
54
- "Privacy Policy": "",
55
+ "Privacy Policy": "Kebijakan pribadi",
55
56
  "Processing": "Sedang diproses",
56
57
  "Processing progress cannot be updated at the moment. Don’t worry! All your file data are still in progress.": "Perkembangan terkait proses belum dapat diperbarui saat ini. Jangan khawatir! Semua data Anda masih dalam proses .",
57
58
  "Quantity of files should be less than {limit}": "Jumlah dokumen tidak bisa lebih dari {limit}",
@@ -62,14 +63,14 @@
62
63
  "Reset All Filters": "Setel ulang filter",
63
64
  "Result": "Hasil",
64
65
  "Result: Success {success_num}; Error {fail_num}": "Hasil: Sukses {success_num}; Kesalahan {fail_num}",
65
- "Review and Submit": "",
66
+ "Review and Submit": "Tinjau dan Kirim",
66
67
  "Rows per page": "Baris per halaman",
67
68
  "Search": "Mencari",
68
69
  "Searching...": "Mencari...",
69
70
  "Select All": "Pilih Semua",
70
71
  "Send OTP": "Kirim OTP",
71
72
  "Submit": "Ajukan",
72
- "Terms of Use": "",
73
+ "Terms of Use": "Syarat Penggunaan",
73
74
  "The file type is not supported.": "Jenis file tidak didukung.",
74
75
  "There are no options available currently": "Tidak ada opsi yang tersedia saat ini",
75
76
  "This Month": "Bulan ini",
@@ -77,7 +78,7 @@
77
78
  "Uploading": "Mengunggah",
78
79
  "We support CSV or XLSX files (less than 20M each).": "Kami mendukung file CSV atau XLSX (Ukuran maksimal 20 MB) .",
79
80
  "Yes, Close": "Ya, Tutup",
80
- "and": "",
81
+ "and": "dan",
81
82
  "browse": "Telusuri",
82
83
  "or": "atau",
83
84
  "{beginIndex}-{endIndex} of {total}": "{beginIndex}-{endIndex} dari {total}",
@@ -86,5 +87,9 @@
86
87
  "{count} files attached.": "{count} file terlampir.",
87
88
  "{currentStep} of {allSteps}": "{currentStep} dari {allSteps}",
88
89
  "{doneNumber} files imported.": "{doneNumber} data terunggah.",
90
+ "{label} must be at least {minLength} digits.": "{label} minimal harus {minLength} digit.",
91
+ "{label} must be less than {maxLength} digits.": "{label} harus kurang dari {maxLength} digit.",
92
+ "{label} must be {length} digits.": "{label} harus {length} digit.",
93
+ "{label} must be {minLength} - {maxLength} digits.": "{label} harus {minLength} - {maxLength} digit.",
89
94
  "{processingNumber} files in progress...": "{processingNumber} data dalam proses..."
90
95
  }
@@ -54,10 +54,10 @@ var LocaleProvider = function LocaleProvider(_ref) {
54
54
  values = _ref2.values;
55
55
 
56
56
  if (!values || !Object.keys(values).length) {
57
- return locale[id];
57
+ return locale[id] || id;
58
58
  }
59
59
 
60
- return locale[id].replaceAll(/\{(.+?)\}/g, function (_, name) {
60
+ return (locale[id] || id).replaceAll(/\{(.+?)\}/g, function (_, name) {
61
61
  return values[name];
62
62
  });
63
63
  };