iglooform 2.5.10 → 2.5.13
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/form/element/index.js +8 -1
- package/es/form/elements.js +2 -1
- package/es/free-form/element/index.js +8 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/input/index.d.ts +1 -0
- package/es/input/index.js +1 -0
- package/es/input/input-id.d.ts +6 -0
- package/es/input/input-id.js +112 -0
- package/es/input/input-number.js +0 -14
- package/es/locale/en-US/messages.json +1 -0
- package/es/locale/id-ID/messages.json +1 -0
- package/es/locale/th-TH/messages.json +1 -0
- package/es/locale/vi-VN/messages.json +1 -0
- package/es/locale/zh-CN/messages.json +1 -0
- package/es/locale/zh-TW/messages.json +1 -0
- package/es/select/attached-select.js +2 -2
- package/es/select/select.js +4 -4
- package/es/upload/index.js +10 -8
- package/es/upload-photo/index.d.ts +1 -0
- package/es/upload-photo/index.js +4 -0
- package/es/utils/option-utils.d.ts +1 -0
- package/es/utils/option-utils.js +21 -2
- package/lib/form/element/index.js +8 -1
- package/lib/form/elements.js +1 -0
- package/lib/free-form/element/index.js +8 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -0
- package/lib/input/index.d.ts +1 -0
- package/lib/input/index.js +8 -0
- package/lib/input/input-id.d.ts +6 -0
- package/lib/input/input-id.js +127 -0
- package/lib/input/input-number.js +0 -14
- package/lib/locale/en-US/messages.json +1 -0
- package/lib/locale/id-ID/messages.json +1 -0
- package/lib/locale/th-TH/messages.json +1 -0
- package/lib/locale/vi-VN/messages.json +1 -0
- package/lib/locale/zh-CN/messages.json +1 -0
- package/lib/locale/zh-TW/messages.json +1 -0
- package/lib/select/attached-select.js +1 -1
- package/lib/select/select.js +4 -4
- package/lib/upload/index.js +10 -8
- package/lib/upload-photo/index.d.ts +1 -0
- package/lib/upload-photo/index.js +4 -0
- package/lib/utils/option-utils.d.ts +1 -0
- package/lib/utils/option-utils.js +25 -3
- package/package.json +1 -1
package/es/form/element/index.js
CHANGED
|
@@ -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:
|
|
174
|
+
value: value,
|
|
168
175
|
errors: []
|
|
169
176
|
}]);
|
|
170
177
|
}, [formItemProps.copiedValue.value]);
|
package/es/form/elements.js
CHANGED
|
@@ -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,
|
|
@@ -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:
|
|
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';
|
package/es/input/index.d.ts
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;
|
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,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;
|
package/es/input/input-number.js
CHANGED
|
@@ -108,20 +108,6 @@ IglooInputNumber.formItemPropsHandler = function (config) {
|
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
if (idType === 'KTP') {
|
|
112
|
-
rules.push({
|
|
113
|
-
validator: function validator(rule, value) {
|
|
114
|
-
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)) {
|
|
115
|
-
return Promise.reject(staticFormatMessage({
|
|
116
|
-
id: 'Invalid KTP Number.'
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return Promise.resolve();
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
111
|
return {
|
|
126
112
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
127
113
|
var value = e.target.value;
|
|
@@ -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",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
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",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"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.": "ข้าพเจ้ายืนยันว่าข้อความที่ข้าพเจ้าได้อธิบายข้างต้นนั้นเป็นความจริง และยืนยันว่าความเสียหายที่เกิดขึ้นนั้นเกิดจากอุบัติเหตุ ปราศจากการวางแผน หรือ การเห็นพ้องร่วมกันกับฝ่ายอื่น",
|
|
31
31
|
"Import": "นำเข้า",
|
|
32
|
+
"Invalid KTP Number.": "",
|
|
32
33
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "แนะนำให้เลือกจำนวนไม่เกิน {colMax} เพื่อให้แน่ใจว่ามองเห็นค่าเริ่มต้นของข้อมูลแต่ละคอลัมน์",
|
|
33
34
|
"Last 7 Days": "เมื่อ 7 วันที่แล้ว",
|
|
34
35
|
"Last Day": "วันสุดท้าย",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"I agree to the Igloo": "Tôi đồng ý với 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.": "Tôi tuyên bố rằng những điều tôi đã mô tả ở trên là đúng sự thật. Tôi tuyên bố thêm rằng tổn thất xảy ra là do ngẫu nhiên, không có kế hoạch hoặc sự đồng thuận với các bên khác.",
|
|
31
31
|
"Import": "Nhập",
|
|
32
|
+
"Invalid KTP Number.": "",
|
|
32
33
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Vui lòng chọn không quá {colMax} cột.",
|
|
33
34
|
"Last 7 Days": "7 ngày gần nhất",
|
|
34
35
|
"Last Day": "ngày cuối",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"I agree to the Igloo": "我同意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.": "我承诺上述信息均真实有效,并且物品遗失纯属意外。",
|
|
31
31
|
"Import": "导入",
|
|
32
|
+
"Invalid KTP Number.": "",
|
|
32
33
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建议不要选择超过{colMax}个字段,以确保最佳展示效果。",
|
|
33
34
|
"Last 7 Days": "过去7天",
|
|
34
35
|
"Last Day": "昨天",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"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.": "我聲明我上面描述的陳述是真的。我進一步宣布發生損失是偶然的,沒有規劃或與其他方的共識。",
|
|
31
31
|
"Import": "導入",
|
|
32
|
+
"Invalid KTP Number.": "",
|
|
32
33
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建議選擇不超過{colMax}指標以確保每個列輸入的默認可見性。",
|
|
33
34
|
"Last 7 Days": "過去7天",
|
|
34
35
|
"Last Day": "過去1天",
|
|
@@ -43,7 +43,7 @@ import LocaleContext from '../locale/locale-context';
|
|
|
43
43
|
import Button from '../button';
|
|
44
44
|
import Input from '../input';
|
|
45
45
|
import './style';
|
|
46
|
-
import { compareOptions, optionsHOC } from '../utils/option-utils';
|
|
46
|
+
import { compareOptions, compareSelected, optionsHOC } from '../utils/option-utils';
|
|
47
47
|
var Option = _Select.Option,
|
|
48
48
|
OptGroup = _Select.OptGroup;
|
|
49
49
|
export { Option, OptGroup };
|
|
@@ -84,7 +84,7 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
84
84
|
|
|
85
85
|
var originOptions = useRef(options);
|
|
86
86
|
useEffect(function () {
|
|
87
|
-
typeof rest.onChange === 'function' && valueProp
|
|
87
|
+
typeof rest.onChange === 'function' && compareSelected(selected, valueProp) && rest.onChange(selected, selectedOptions);
|
|
88
88
|
}, [selected]);
|
|
89
89
|
useEffect(function () {
|
|
90
90
|
valueProp !== selected && setSelected(valueProp);
|
package/es/select/select.js
CHANGED
|
@@ -59,7 +59,10 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
59
59
|
return _jsx(_Select, _objectSpread(_objectSpread({
|
|
60
60
|
placeholder: placeholder || formatMessage({
|
|
61
61
|
id: 'Please select'
|
|
62
|
-
})
|
|
62
|
+
}),
|
|
63
|
+
getPopupContainer: function getPopupContainer(trigger) {
|
|
64
|
+
return trigger.parentNode;
|
|
65
|
+
}
|
|
63
66
|
}, omit(rest, formMethods)), {}, {
|
|
64
67
|
options: children ? void 0 : options,
|
|
65
68
|
value: value,
|
|
@@ -82,9 +85,6 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
82
85
|
}
|
|
83
86
|
})]
|
|
84
87
|
}),
|
|
85
|
-
getPopupContainer: function getPopupContainer(trigger) {
|
|
86
|
-
return trigger.parentNode;
|
|
87
|
-
},
|
|
88
88
|
className: classnames('igloo-select', className),
|
|
89
89
|
onDropdownVisibleChange: function onDropdownVisibleChange(open) {
|
|
90
90
|
setOpen(open);
|
package/es/upload/index.js
CHANGED
|
@@ -566,7 +566,8 @@ var IglooUpload = function IglooUpload(props) {
|
|
|
566
566
|
handleReUpload: handleReUpload,
|
|
567
567
|
handlePreview: handlePreview,
|
|
568
568
|
handleDelete: handleDelete,
|
|
569
|
-
containerRef: containerRef
|
|
569
|
+
containerRef: containerRef,
|
|
570
|
+
disabled: props.disabled
|
|
570
571
|
})]
|
|
571
572
|
});
|
|
572
573
|
};
|
|
@@ -577,7 +578,8 @@ var FileList = function FileList(_ref7) {
|
|
|
577
578
|
limit = _ref7.limit,
|
|
578
579
|
handleDelete = _ref7.handleDelete,
|
|
579
580
|
handlePreview = _ref7.handlePreview,
|
|
580
|
-
handleReUpload = _ref7.handleReUpload
|
|
581
|
+
handleReUpload = _ref7.handleReUpload,
|
|
582
|
+
disabled = _ref7.disabled;
|
|
581
583
|
|
|
582
584
|
var _useState3 = useState(false),
|
|
583
585
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -648,10 +650,10 @@ var FileList = function FileList(_ref7) {
|
|
|
648
650
|
style: {
|
|
649
651
|
fontSize: 24,
|
|
650
652
|
color: '#999999',
|
|
651
|
-
cursor: 'pointer'
|
|
653
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
652
654
|
},
|
|
653
655
|
onClick: function onClick() {
|
|
654
|
-
return handleDelete(index);
|
|
656
|
+
return !disabled && handleDelete(index);
|
|
655
657
|
}
|
|
656
658
|
})]
|
|
657
659
|
}), status === 'failed' && _jsxs("div", {
|
|
@@ -660,20 +662,20 @@ var FileList = function FileList(_ref7) {
|
|
|
660
662
|
style: {
|
|
661
663
|
fontSize: 24,
|
|
662
664
|
color: '#999999',
|
|
663
|
-
cursor: 'pointer'
|
|
665
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
664
666
|
},
|
|
665
667
|
onClick: function onClick() {
|
|
666
|
-
return handleReUpload(index);
|
|
668
|
+
return !disabled && handleReUpload(index);
|
|
667
669
|
},
|
|
668
670
|
className: 'igloo-upload-preview-item-operation-left-icon'
|
|
669
671
|
}), _jsx(CrossOutlined, {
|
|
670
672
|
style: {
|
|
671
673
|
fontSize: 24,
|
|
672
674
|
color: '#999999',
|
|
673
|
-
cursor: 'pointer'
|
|
675
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
674
676
|
},
|
|
675
677
|
onClick: function onClick() {
|
|
676
|
-
return handleDelete(index);
|
|
678
|
+
return !disabled && handleDelete(index);
|
|
677
679
|
}
|
|
678
680
|
})]
|
|
679
681
|
})]
|
package/es/upload-photo/index.js
CHANGED
|
@@ -721,6 +721,10 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
721
721
|
};
|
|
722
722
|
|
|
723
723
|
var getBadge = function getBadge(status, index, limit) {
|
|
724
|
+
if (props.disabled) {
|
|
725
|
+
return null;
|
|
726
|
+
}
|
|
727
|
+
|
|
724
728
|
if (status === 'progress') {
|
|
725
729
|
return _jsx("div", {
|
|
726
730
|
children: _jsx(LoadingOutlined, {
|
|
@@ -3,6 +3,7 @@ import { FormInstance } from 'antd/es/form';
|
|
|
3
3
|
import { NamePath } from 'antd/es/form/interface';
|
|
4
4
|
import { SelectProps, SelectValue } from 'antd/es/select';
|
|
5
5
|
export declare const compareOptions: (newOptions: any[], oldOptions?: any[] | undefined) => boolean;
|
|
6
|
+
export declare const compareSelected: (newValue: any | any[], oldValue: any | any[]) => boolean;
|
|
6
7
|
declare type Options = SelectProps<SelectValue>['options'];
|
|
7
8
|
export interface HOCProps extends IglooComponentProps {
|
|
8
9
|
options?: Options;
|
package/es/utils/option-utils.js
CHANGED
|
@@ -14,8 +14,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
14
14
|
|
|
15
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
16
|
|
|
17
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
18
|
-
|
|
19
17
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
20
18
|
|
|
21
19
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -36,6 +34,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
36
34
|
|
|
37
35
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
38
36
|
|
|
37
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
38
|
+
|
|
39
39
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
40
40
|
import { useEffect, useState, useContext, useRef } from 'react';
|
|
41
41
|
import FormContext from '../form-context';
|
|
@@ -62,6 +62,25 @@ export var compareOptions = function compareOptions(newOptions, oldOptions) {
|
|
|
62
62
|
|
|
63
63
|
return false;
|
|
64
64
|
};
|
|
65
|
+
export var compareSelected = function compareSelected(newValue, oldValue) {
|
|
66
|
+
if (_typeof(newValue) !== _typeof(oldValue)) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (Array.isArray(newValue) && Array.isArray(oldValue)) {
|
|
71
|
+
if (newValue.length !== oldValue.length) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return newValue.every(function (v) {
|
|
76
|
+
return oldValue.find(function (ov) {
|
|
77
|
+
return v === ov;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return newValue !== oldValue;
|
|
83
|
+
};
|
|
65
84
|
export function optionsHOC(Component) {
|
|
66
85
|
return function (props) {
|
|
67
86
|
var options = props.options,
|
|
@@ -191,9 +191,16 @@ var Element = function Element(_ref) {
|
|
|
191
191
|
|
|
192
192
|
(0, _react.useEffect)(function () {
|
|
193
193
|
if (!formItemProps.name || preview || !formItemProps.copiedValue.copied) return;
|
|
194
|
+
var originalValue = form === null || form === void 0 ? void 0 : form.getFieldValue(formItemProps.name);
|
|
195
|
+
var value = formItemProps.copiedValue.value;
|
|
196
|
+
|
|
197
|
+
if (_typeof(originalValue) === 'object' && _typeof(value) === 'object') {
|
|
198
|
+
value = Object.assign(originalValue, formItemProps.copiedValue.value);
|
|
199
|
+
}
|
|
200
|
+
|
|
194
201
|
form && form.setFields([{
|
|
195
202
|
name: formItemProps.name,
|
|
196
|
-
value:
|
|
203
|
+
value: value,
|
|
197
204
|
errors: []
|
|
198
205
|
}]);
|
|
199
206
|
}, [formItemProps.copiedValue.value]);
|
package/lib/form/elements.js
CHANGED
|
@@ -182,9 +182,16 @@ var Element = function Element(props) {
|
|
|
182
182
|
|
|
183
183
|
(0, _react.useEffect)(function () {
|
|
184
184
|
if (!formItemProps.name || preview || !formItemProps.copiedValue.copied) return;
|
|
185
|
+
var originalValue = form === null || form === void 0 ? void 0 : form.getFieldValue(formItemProps.name);
|
|
186
|
+
var value = formItemProps.copiedValue.value;
|
|
187
|
+
|
|
188
|
+
if (_typeof(originalValue) === 'object' && _typeof(value) === 'object') {
|
|
189
|
+
value = Object.assign(originalValue, formItemProps.copiedValue.value);
|
|
190
|
+
}
|
|
191
|
+
|
|
185
192
|
form && form.setFields([{
|
|
186
193
|
name: formItemProps.name,
|
|
187
|
-
value:
|
|
194
|
+
value: value,
|
|
188
195
|
errors: []
|
|
189
196
|
}]);
|
|
190
197
|
}, [formItemProps.copiedValue.value]);
|
package/lib/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/lib/index.js
CHANGED
|
@@ -26,6 +26,7 @@ var _exportNames = {
|
|
|
26
26
|
InputDate: true,
|
|
27
27
|
CreditCard: true,
|
|
28
28
|
ExpiryDate: true,
|
|
29
|
+
InputId: true,
|
|
29
30
|
Select: true,
|
|
30
31
|
TimeSelect: true,
|
|
31
32
|
AttachedSelect: true,
|
|
@@ -310,6 +311,12 @@ Object.defineProperty(exports, "InputDate", {
|
|
|
310
311
|
return _input.InputDate;
|
|
311
312
|
}
|
|
312
313
|
});
|
|
314
|
+
Object.defineProperty(exports, "InputId", {
|
|
315
|
+
enumerable: true,
|
|
316
|
+
get: function get() {
|
|
317
|
+
return _input.InputId;
|
|
318
|
+
}
|
|
319
|
+
});
|
|
313
320
|
Object.defineProperty(exports, "InputNumber", {
|
|
314
321
|
enumerable: true,
|
|
315
322
|
get: function get() {
|
package/lib/input/index.d.ts
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;
|
package/lib/input/index.js
CHANGED
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "InputDate", {
|
|
|
33
33
|
return _inputDate.default;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "InputId", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _inputId.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "InputNumber", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function get() {
|
|
@@ -85,6 +91,8 @@ var _otp = _interopRequireDefault(require("./otp"));
|
|
|
85
91
|
|
|
86
92
|
var _expiryDate = _interopRequireDefault(require("./expiry-date"));
|
|
87
93
|
|
|
94
|
+
var _inputId = _interopRequireDefault(require("./input-id"));
|
|
95
|
+
|
|
88
96
|
var _input = _interopRequireDefault(require("./input"));
|
|
89
97
|
|
|
90
98
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
require("antd/es/input/style");
|
|
9
|
+
|
|
10
|
+
var _input = _interopRequireDefault(require("antd/es/input"));
|
|
11
|
+
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
var _omit = _interopRequireDefault(require("omit.js"));
|
|
15
|
+
|
|
16
|
+
var _formMethods = _interopRequireDefault(require("../utils/form-methods"));
|
|
17
|
+
|
|
18
|
+
var _locale = require("../locale");
|
|
19
|
+
|
|
20
|
+
require("./style/index.less");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
var InputId = function InputId(props) {
|
|
31
|
+
return (0, _jsxRuntime.jsx)(_input.default, _objectSpread(_objectSpread({
|
|
32
|
+
className: "igloo-input"
|
|
33
|
+
}, (0, _omit.default)(props, _formMethods.default)), {}, {
|
|
34
|
+
type: "number"
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
InputId.formItemPropsHandler = function (config) {
|
|
39
|
+
var length = config.length,
|
|
40
|
+
maxLength = config.maxLength,
|
|
41
|
+
minLength = config.minLength,
|
|
42
|
+
label = config.label,
|
|
43
|
+
idType = config.idType;
|
|
44
|
+
var rules = [];
|
|
45
|
+
|
|
46
|
+
if (length !== undefined) {
|
|
47
|
+
rules.push({
|
|
48
|
+
validator: function validator(_, value) {
|
|
49
|
+
if (value === undefined || value === null || String(value).length === length) return Promise.resolve();
|
|
50
|
+
return Promise.reject((0, _locale.staticFormatMessage)({
|
|
51
|
+
id: '{label} must be {length} digits.',
|
|
52
|
+
values: {
|
|
53
|
+
length: length,
|
|
54
|
+
label: label
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (maxLength !== undefined && minLength !== undefined) {
|
|
62
|
+
rules.push({
|
|
63
|
+
validator: function validator(_, value) {
|
|
64
|
+
if (value === undefined || value === null || String(value).length >= minLength && String(value).length <= maxLength) return Promise.resolve();
|
|
65
|
+
return Promise.reject((0, _locale.staticFormatMessage)({
|
|
66
|
+
id: '{label} must be {minLength} - {maxLength} digits.',
|
|
67
|
+
values: {
|
|
68
|
+
maxLength: maxLength,
|
|
69
|
+
minLength: minLength,
|
|
70
|
+
label: label
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (maxLength !== undefined && minLength === undefined) {
|
|
78
|
+
rules.push({
|
|
79
|
+
validator: function validator(_, value) {
|
|
80
|
+
if (value === undefined || value === null || String(value).length <= maxLength) return Promise.resolve();
|
|
81
|
+
return Promise.reject((0, _locale.staticFormatMessage)({
|
|
82
|
+
id: '{label} must be less than {maxLength} digits.',
|
|
83
|
+
values: {
|
|
84
|
+
maxLength: maxLength,
|
|
85
|
+
label: label
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (maxLength === undefined && minLength !== undefined) {
|
|
93
|
+
rules.push({
|
|
94
|
+
validator: function validator(_, value) {
|
|
95
|
+
if (value === undefined || value === null || String(value).length >= minLength) return Promise.resolve();
|
|
96
|
+
return Promise.reject((0, _locale.staticFormatMessage)({
|
|
97
|
+
id: '{label} must be at least {minLength} digits.',
|
|
98
|
+
values: {
|
|
99
|
+
minLength: minLength,
|
|
100
|
+
label: label
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (idType === 'KTP') {
|
|
108
|
+
rules.push({
|
|
109
|
+
validator: function validator(rule, value) {
|
|
110
|
+
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)) {
|
|
111
|
+
return Promise.reject((0, _locale.staticFormatMessage)({
|
|
112
|
+
id: 'Invalid KTP Number.'
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return Promise.resolve();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
rules: rules
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var _default = InputId;
|
|
127
|
+
exports.default = _default;
|
|
@@ -122,20 +122,6 @@ IglooInputNumber.formItemPropsHandler = function (config) {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
if (idType === 'KTP') {
|
|
126
|
-
rules.push({
|
|
127
|
-
validator: function validator(rule, value) {
|
|
128
|
-
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)) {
|
|
129
|
-
return Promise.reject((0, _locale.staticFormatMessage)({
|
|
130
|
-
id: 'Invalid KTP Number.'
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return Promise.resolve();
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
125
|
return {
|
|
140
126
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
141
127
|
var value = e.target.value;
|
|
@@ -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",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
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",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"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.": "ข้าพเจ้ายืนยันว่าข้อความที่ข้าพเจ้าได้อธิบายข้างต้นนั้นเป็นความจริง และยืนยันว่าความเสียหายที่เกิดขึ้นนั้นเกิดจากอุบัติเหตุ ปราศจากการวางแผน หรือ การเห็นพ้องร่วมกันกับฝ่ายอื่น",
|
|
31
31
|
"Import": "นำเข้า",
|
|
32
|
+
"Invalid KTP Number.": "",
|
|
32
33
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "แนะนำให้เลือกจำนวนไม่เกิน {colMax} เพื่อให้แน่ใจว่ามองเห็นค่าเริ่มต้นของข้อมูลแต่ละคอลัมน์",
|
|
33
34
|
"Last 7 Days": "เมื่อ 7 วันที่แล้ว",
|
|
34
35
|
"Last Day": "วันสุดท้าย",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"I agree to the Igloo": "Tôi đồng ý với 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.": "Tôi tuyên bố rằng những điều tôi đã mô tả ở trên là đúng sự thật. Tôi tuyên bố thêm rằng tổn thất xảy ra là do ngẫu nhiên, không có kế hoạch hoặc sự đồng thuận với các bên khác.",
|
|
31
31
|
"Import": "Nhập",
|
|
32
|
+
"Invalid KTP Number.": "",
|
|
32
33
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Vui lòng chọn không quá {colMax} cột.",
|
|
33
34
|
"Last 7 Days": "7 ngày gần nhất",
|
|
34
35
|
"Last Day": "ngày cuối",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"I agree to the Igloo": "我同意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.": "我承诺上述信息均真实有效,并且物品遗失纯属意外。",
|
|
31
31
|
"Import": "导入",
|
|
32
|
+
"Invalid KTP Number.": "",
|
|
32
33
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建议不要选择超过{colMax}个字段,以确保最佳展示效果。",
|
|
33
34
|
"Last 7 Days": "过去7天",
|
|
34
35
|
"Last Day": "昨天",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"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.": "我聲明我上面描述的陳述是真的。我進一步宣布發生損失是偶然的,沒有規劃或與其他方的共識。",
|
|
31
31
|
"Import": "導入",
|
|
32
|
+
"Invalid KTP Number.": "",
|
|
32
33
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建議選擇不超過{colMax}指標以確保每個列輸入的默認可見性。",
|
|
33
34
|
"Last 7 Days": "過去7天",
|
|
34
35
|
"Last Day": "過去1天",
|
|
@@ -108,7 +108,7 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
108
108
|
|
|
109
109
|
var originOptions = (0, _react.useRef)(options);
|
|
110
110
|
(0, _react.useEffect)(function () {
|
|
111
|
-
typeof rest.onChange === 'function' &&
|
|
111
|
+
typeof rest.onChange === 'function' && (0, _optionUtils.compareSelected)(selected, valueProp) && rest.onChange(selected, selectedOptions);
|
|
112
112
|
}, [selected]);
|
|
113
113
|
(0, _react.useEffect)(function () {
|
|
114
114
|
valueProp !== selected && setSelected(valueProp);
|
package/lib/select/select.js
CHANGED
|
@@ -79,7 +79,10 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
79
79
|
return (0, _jsxRuntime.jsx)(_select.default, _objectSpread(_objectSpread({
|
|
80
80
|
placeholder: placeholder || formatMessage({
|
|
81
81
|
id: 'Please select'
|
|
82
|
-
})
|
|
82
|
+
}),
|
|
83
|
+
getPopupContainer: function getPopupContainer(trigger) {
|
|
84
|
+
return trigger.parentNode;
|
|
85
|
+
}
|
|
83
86
|
}, (0, _omit.default)(rest, _formMethods.default)), {}, {
|
|
84
87
|
options: children ? void 0 : options,
|
|
85
88
|
value: value,
|
|
@@ -102,9 +105,6 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
102
105
|
}
|
|
103
106
|
})]
|
|
104
107
|
}),
|
|
105
|
-
getPopupContainer: function getPopupContainer(trigger) {
|
|
106
|
-
return trigger.parentNode;
|
|
107
|
-
},
|
|
108
108
|
className: (0, _classnames.default)('igloo-select', className),
|
|
109
109
|
onDropdownVisibleChange: function onDropdownVisibleChange(open) {
|
|
110
110
|
setOpen(open);
|
package/lib/upload/index.js
CHANGED
|
@@ -592,7 +592,8 @@ var IglooUpload = function IglooUpload(props) {
|
|
|
592
592
|
handleReUpload: handleReUpload,
|
|
593
593
|
handlePreview: handlePreview,
|
|
594
594
|
handleDelete: handleDelete,
|
|
595
|
-
containerRef: containerRef
|
|
595
|
+
containerRef: containerRef,
|
|
596
|
+
disabled: props.disabled
|
|
596
597
|
})]
|
|
597
598
|
});
|
|
598
599
|
};
|
|
@@ -603,7 +604,8 @@ var FileList = function FileList(_ref7) {
|
|
|
603
604
|
limit = _ref7.limit,
|
|
604
605
|
handleDelete = _ref7.handleDelete,
|
|
605
606
|
handlePreview = _ref7.handlePreview,
|
|
606
|
-
handleReUpload = _ref7.handleReUpload
|
|
607
|
+
handleReUpload = _ref7.handleReUpload,
|
|
608
|
+
disabled = _ref7.disabled;
|
|
607
609
|
|
|
608
610
|
var _useState3 = (0, _react.useState)(false),
|
|
609
611
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -673,10 +675,10 @@ var FileList = function FileList(_ref7) {
|
|
|
673
675
|
style: {
|
|
674
676
|
fontSize: 24,
|
|
675
677
|
color: '#999999',
|
|
676
|
-
cursor: 'pointer'
|
|
678
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
677
679
|
},
|
|
678
680
|
onClick: function onClick() {
|
|
679
|
-
return handleDelete(index);
|
|
681
|
+
return !disabled && handleDelete(index);
|
|
680
682
|
}
|
|
681
683
|
})]
|
|
682
684
|
}), status === 'failed' && (0, _jsxRuntime.jsxs)("div", {
|
|
@@ -685,20 +687,20 @@ var FileList = function FileList(_ref7) {
|
|
|
685
687
|
style: {
|
|
686
688
|
fontSize: 24,
|
|
687
689
|
color: '#999999',
|
|
688
|
-
cursor: 'pointer'
|
|
690
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
689
691
|
},
|
|
690
692
|
onClick: function onClick() {
|
|
691
|
-
return handleReUpload(index);
|
|
693
|
+
return !disabled && handleReUpload(index);
|
|
692
694
|
},
|
|
693
695
|
className: 'igloo-upload-preview-item-operation-left-icon'
|
|
694
696
|
}), (0, _jsxRuntime.jsx)(_iglooicon.CrossOutlined, {
|
|
695
697
|
style: {
|
|
696
698
|
fontSize: 24,
|
|
697
699
|
color: '#999999',
|
|
698
|
-
cursor: 'pointer'
|
|
700
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
699
701
|
},
|
|
700
702
|
onClick: function onClick() {
|
|
701
|
-
return handleDelete(index);
|
|
703
|
+
return !disabled && handleDelete(index);
|
|
702
704
|
}
|
|
703
705
|
})]
|
|
704
706
|
})]
|
|
@@ -755,6 +755,10 @@ var UploadPhoto = function UploadPhoto(props) {
|
|
|
755
755
|
};
|
|
756
756
|
|
|
757
757
|
var getBadge = function getBadge(status, index, limit) {
|
|
758
|
+
if (props.disabled) {
|
|
759
|
+
return null;
|
|
760
|
+
}
|
|
761
|
+
|
|
758
762
|
if (status === 'progress') {
|
|
759
763
|
return (0, _jsxRuntime.jsx)("div", {
|
|
760
764
|
children: (0, _jsxRuntime.jsx)(_iglooicon.LoadingOutlined, {
|
|
@@ -3,6 +3,7 @@ import { FormInstance } from 'antd/es/form';
|
|
|
3
3
|
import { NamePath } from 'antd/es/form/interface';
|
|
4
4
|
import { SelectProps, SelectValue } from 'antd/es/select';
|
|
5
5
|
export declare const compareOptions: (newOptions: any[], oldOptions?: any[] | undefined) => boolean;
|
|
6
|
+
export declare const compareSelected: (newValue: any | any[], oldValue: any | any[]) => boolean;
|
|
6
7
|
declare type Options = SelectProps<SelectValue>['options'];
|
|
7
8
|
export interface HOCProps extends IglooComponentProps {
|
|
8
9
|
options?: Options;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.compareOptions = void 0;
|
|
6
|
+
exports.compareSelected = exports.compareOptions = void 0;
|
|
7
7
|
exports.optionsHOC = optionsHOC;
|
|
8
8
|
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -32,8 +32,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
32
32
|
|
|
33
33
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
34
34
|
|
|
35
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
36
|
-
|
|
37
35
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
38
36
|
|
|
39
37
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -54,6 +52,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
54
52
|
|
|
55
53
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
56
54
|
|
|
55
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
56
|
+
|
|
57
57
|
var compareOptions = function compareOptions(newOptions, oldOptions) {
|
|
58
58
|
if (!Array.isArray(oldOptions)) {
|
|
59
59
|
return true;
|
|
@@ -79,6 +79,28 @@ var compareOptions = function compareOptions(newOptions, oldOptions) {
|
|
|
79
79
|
|
|
80
80
|
exports.compareOptions = compareOptions;
|
|
81
81
|
|
|
82
|
+
var compareSelected = function compareSelected(newValue, oldValue) {
|
|
83
|
+
if (_typeof(newValue) !== _typeof(oldValue)) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (Array.isArray(newValue) && Array.isArray(oldValue)) {
|
|
88
|
+
if (newValue.length !== oldValue.length) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return newValue.every(function (v) {
|
|
93
|
+
return oldValue.find(function (ov) {
|
|
94
|
+
return v === ov;
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return newValue !== oldValue;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
exports.compareSelected = compareSelected;
|
|
103
|
+
|
|
82
104
|
function optionsHOC(Component) {
|
|
83
105
|
return function (props) {
|
|
84
106
|
var options = props.options,
|