iglooform 2.5.0 → 2.5.3
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/checkbox/index.d.ts +7 -7
- package/es/checkbox/index.js +85 -5
- package/es/form/elements.js +3 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/input/amount.js +14 -3
- package/es/input/input-number.js +14 -3
- package/es/locale/en-US/messages.json +4 -0
- package/es/locale/id-ID/messages.json +4 -0
- package/es/locale/th-TH/messages.json +4 -0
- package/es/locale/vi-VN/messages.json +4 -0
- package/es/locale/zh-CN/messages.json +4 -0
- package/es/locale/zh-TW/messages.json +5 -0
- package/es/radio/index.d.ts +6 -6
- package/es/radio/index.js +79 -22
- package/es/radio/radio-group-with-other.d.ts +1 -1
- package/es/radio/radio-group-with-other.js +41 -4
- package/es/radio/style/empty.svg +12 -0
- package/es/search-box/index.d.ts +31 -0
- package/es/search-box/index.js +266 -0
- package/es/search-box/style/index.d.ts +1 -0
- package/es/search-box/style/index.js +1 -0
- package/es/search-box/style/index.less +162 -0
- package/es/select/attached-select.d.ts +2 -12
- package/es/select/attached-select.js +27 -186
- package/es/upload-photo/index.js +33 -32
- package/es/utils/option-utils.d.ts +24 -0
- package/es/utils/option-utils.js +233 -0
- package/lib/checkbox/index.d.ts +7 -7
- package/lib/checkbox/index.js +87 -5
- package/lib/form/elements.js +4 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +9 -0
- package/lib/input/amount.js +14 -3
- package/lib/input/input-number.js +14 -3
- package/lib/locale/en-US/messages.json +4 -0
- package/lib/locale/id-ID/messages.json +4 -0
- package/lib/locale/th-TH/messages.json +4 -0
- package/lib/locale/vi-VN/messages.json +4 -0
- package/lib/locale/zh-CN/messages.json +4 -0
- package/lib/locale/zh-TW/messages.json +5 -0
- package/lib/radio/index.d.ts +6 -6
- package/lib/radio/index.js +83 -22
- package/lib/radio/radio-group-with-other.d.ts +1 -1
- package/lib/radio/radio-group-with-other.js +41 -3
- package/lib/radio/style/empty.svg +12 -0
- package/lib/search-box/index.d.ts +31 -0
- package/lib/search-box/index.js +287 -0
- package/lib/search-box/style/index.d.ts +1 -0
- package/lib/search-box/style/index.js +3 -0
- package/lib/search-box/style/index.less +162 -0
- package/lib/select/attached-select.d.ts +2 -12
- package/lib/select/attached-select.js +26 -186
- package/lib/upload-photo/index.js +33 -32
- package/lib/utils/option-utils.d.ts +24 -0
- package/lib/utils/option-utils.js +250 -0
- package/package.json +10 -9
package/es/checkbox/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { CheckboxProps, CheckboxGroupProps } from 'antd/es/checkbox';
|
|
2
2
|
import { FC, IglooComponentProps } from '@/types';
|
|
3
|
+
import { ComponentProps } from '../utils/option-utils';
|
|
4
|
+
import { DefaultOptionType } from 'rc-select/lib/Select';
|
|
3
5
|
import './style/index.less';
|
|
4
6
|
interface Props extends IglooComponentProps, CheckboxProps {
|
|
5
7
|
}
|
|
6
|
-
interface Option {
|
|
7
|
-
label?: any;
|
|
8
|
-
value?: string;
|
|
9
|
-
disabled?: boolean;
|
|
8
|
+
export interface Option extends DefaultOptionType {
|
|
10
9
|
extraInfo?: {
|
|
11
10
|
content: any;
|
|
12
11
|
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
13
12
|
};
|
|
14
13
|
}
|
|
15
|
-
export interface IProps extends IglooComponentProps, Omit<CheckboxGroupProps, 'options'
|
|
16
|
-
options: Option[];
|
|
14
|
+
export interface IProps extends IglooComponentProps, Omit<CheckboxGroupProps, 'options'>, ComponentProps {
|
|
17
15
|
className?: string;
|
|
16
|
+
radioType?: string;
|
|
17
|
+
options: Option[];
|
|
18
18
|
}
|
|
19
19
|
declare const IglooCheckbox: FC<Props>;
|
|
20
20
|
export default IglooCheckbox;
|
|
21
|
-
export declare const CheckboxGroup: FC<IProps>;
|
|
21
|
+
export declare const CheckboxGroup: FC<import("../utils/option-utils").HOCProps & IProps>;
|
package/es/checkbox/index.js
CHANGED
|
@@ -4,9 +4,21 @@ import "antd/es/row/style";
|
|
|
4
4
|
import _Row from "antd/es/row";
|
|
5
5
|
import "antd/es/checkbox/style";
|
|
6
6
|
import _Checkbox from "antd/es/checkbox";
|
|
7
|
-
var _excluded = ["className", "options", "value"],
|
|
7
|
+
var _excluded = ["className", "options", "value", "clearWhenOptionsUpdated"],
|
|
8
8
|
_excluded2 = ["label", "value", "extraInfo"];
|
|
9
9
|
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
+
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
19
|
+
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
|
|
10
22
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
23
|
|
|
12
24
|
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; }
|
|
@@ -18,10 +30,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
18
30
|
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; }
|
|
19
31
|
|
|
20
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
|
+
import { useState, useEffect, useRef, useContext } from 'react';
|
|
21
34
|
import Typography from '../typography';
|
|
22
35
|
import formMethods from '../utils/form-methods';
|
|
23
36
|
import omit from 'omit.js';
|
|
24
37
|
import classnames from 'classnames';
|
|
38
|
+
import { compareOptions, optionsHOC } from '../utils/option-utils';
|
|
39
|
+
import LocaleContext from '../locale/locale-context';
|
|
40
|
+
import emptyIcon from '../radio/style/empty.svg';
|
|
25
41
|
import './style/index.less';
|
|
26
42
|
|
|
27
43
|
var IglooCheckbox = function IglooCheckbox(props) {
|
|
@@ -38,17 +54,55 @@ IglooCheckbox.formItemPropsHandler = function (config) {
|
|
|
38
54
|
};
|
|
39
55
|
|
|
40
56
|
export default IglooCheckbox;
|
|
41
|
-
|
|
57
|
+
|
|
58
|
+
var InnerCheckboxGroup = function InnerCheckboxGroup(_ref) {
|
|
42
59
|
var className = _ref.className,
|
|
43
60
|
_ref$options = _ref.options,
|
|
44
61
|
options = _ref$options === void 0 ? [] : _ref$options,
|
|
45
62
|
value = _ref.value,
|
|
63
|
+
_ref$clearWhenOptions = _ref.clearWhenOptionsUpdated,
|
|
64
|
+
clearWhenOptionsUpdated = _ref$clearWhenOptions === void 0 ? false : _ref$clearWhenOptions,
|
|
46
65
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
66
|
|
|
48
|
-
|
|
67
|
+
var _useState = useState(value),
|
|
68
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
69
|
+
selected = _useState2[0],
|
|
70
|
+
setSelected = _useState2[1];
|
|
71
|
+
|
|
72
|
+
var originOptions = useRef(options);
|
|
73
|
+
|
|
74
|
+
var _useContext = useContext(LocaleContext),
|
|
75
|
+
formatMessage = _useContext.formatMessage;
|
|
76
|
+
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
typeof rest.onChange === 'function' && value !== selected && rest.onChange(selected);
|
|
79
|
+
}, [selected]);
|
|
80
|
+
useEffect(function () {
|
|
81
|
+
setSelected(value);
|
|
82
|
+
}, [value]);
|
|
83
|
+
useEffect(function () {
|
|
84
|
+
var setFieldValue = rest.setFieldValue;
|
|
85
|
+
|
|
86
|
+
if (compareOptions(options, originOptions.current)) {
|
|
87
|
+
if (clearWhenOptionsUpdated) {
|
|
88
|
+
typeof setFieldValue === 'function' && setFieldValue();
|
|
89
|
+
} else {
|
|
90
|
+
var foundValue = options.find(function (option) {
|
|
91
|
+
return Array.isArray(value) ? value.includes(option.value) : option.value === value;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (!foundValue && value !== undefined) {
|
|
95
|
+
typeof setFieldValue === 'function' && setFieldValue();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
originOptions.current = options;
|
|
100
|
+
}
|
|
101
|
+
}, [options]);
|
|
102
|
+
return _jsxs(_Checkbox.Group, _objectSpread(_objectSpread({}, omit(rest, formMethods)), {}, {
|
|
49
103
|
className: classnames('igloo-checkbox-group', className),
|
|
50
104
|
value: value,
|
|
51
|
-
children: _jsx(_Row, {
|
|
105
|
+
children: [_jsx(_Row, {
|
|
52
106
|
gutter: [8, 8],
|
|
53
107
|
children: options.map(function (_ref2) {
|
|
54
108
|
var label = _ref2.label,
|
|
@@ -72,10 +126,36 @@ export var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
72
126
|
})]
|
|
73
127
|
}, key);
|
|
74
128
|
})
|
|
75
|
-
})
|
|
129
|
+
}), !options.length && _jsxs("div", {
|
|
130
|
+
style: {
|
|
131
|
+
display: 'flex',
|
|
132
|
+
flexDirection: 'column',
|
|
133
|
+
background: '#f9f9f9',
|
|
134
|
+
padding: 16,
|
|
135
|
+
alignItems: 'center'
|
|
136
|
+
},
|
|
137
|
+
children: [_jsx("img", {
|
|
138
|
+
src: emptyIcon,
|
|
139
|
+
style: {
|
|
140
|
+
width: 32,
|
|
141
|
+
height: 24
|
|
142
|
+
}
|
|
143
|
+
}), _jsx(Typography, {
|
|
144
|
+
level: "h5",
|
|
145
|
+
style: {
|
|
146
|
+
color: '#212121',
|
|
147
|
+
marginTop: 8
|
|
148
|
+
},
|
|
149
|
+
children: formatMessage({
|
|
150
|
+
id: 'There are no options available currently'
|
|
151
|
+
})
|
|
152
|
+
})]
|
|
153
|
+
})]
|
|
76
154
|
}));
|
|
77
155
|
};
|
|
78
156
|
|
|
157
|
+
export var CheckboxGroup = optionsHOC(InnerCheckboxGroup);
|
|
158
|
+
|
|
79
159
|
CheckboxGroup.formItemPropsHandler = function () {
|
|
80
160
|
return {};
|
|
81
161
|
};
|
package/es/form/elements.js
CHANGED
|
@@ -12,6 +12,7 @@ import Divider from './divider';
|
|
|
12
12
|
import UploadPhoto from '../upload-photo';
|
|
13
13
|
import RenderElement from './render';
|
|
14
14
|
import Typography from '../typography';
|
|
15
|
+
import SearchBox from '../search-box';
|
|
15
16
|
var elementMap = {
|
|
16
17
|
Input: Input,
|
|
17
18
|
PhoneNumber: PhoneNumber,
|
|
@@ -42,7 +43,8 @@ var elementMap = {
|
|
|
42
43
|
InputDate: InputDate,
|
|
43
44
|
Confirmation: Confirmation,
|
|
44
45
|
ExpiryDate: ExpiryDate,
|
|
45
|
-
Typography: Typography
|
|
46
|
+
Typography: Typography,
|
|
47
|
+
SearchBox: SearchBox
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
var Unknown = function Unknown() {
|
package/es/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export { default as MobileInsurerDetail } from './mobile-insurer-detail';
|
|
|
35
35
|
export { default as Layout } from './layout';
|
|
36
36
|
export { default as DetailPanel } from './detail-panel';
|
|
37
37
|
export { default as message } from './global-message';
|
|
38
|
+
export { default as SearchBox } from './search-box';
|
|
38
39
|
export { default as FreeForm } from './free-form';
|
|
39
40
|
export { default as FormItem } from './free-form/element';
|
|
40
41
|
export { default as FormPages } from './free-form/pages';
|
package/es/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export { default as MobileInsurerDetail } from './mobile-insurer-detail';
|
|
|
35
35
|
export { default as Layout } from './layout';
|
|
36
36
|
export { default as DetailPanel } from './detail-panel';
|
|
37
37
|
export { default as message } from './global-message';
|
|
38
|
+
export { default as SearchBox } from './search-box';
|
|
38
39
|
export { default as FreeForm } from './free-form';
|
|
39
40
|
export { default as FormItem } from './free-form/element';
|
|
40
41
|
export { default as FormPages } from './free-form/pages';
|
package/es/input/amount.js
CHANGED
|
@@ -47,8 +47,15 @@ var Amount = function Amount(_ref) {
|
|
|
47
47
|
var handleOnBlur = function handleOnBlur(e) {
|
|
48
48
|
var onChange = rest.onChange;
|
|
49
49
|
|
|
50
|
-
if (typeof value === 'string'
|
|
51
|
-
|
|
50
|
+
if (typeof value === 'string') {
|
|
51
|
+
if (value.endsWith('.')) {
|
|
52
|
+
e.target.value = value.replace('.', '');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (value.endsWith('0') && value.includes('.')) {
|
|
56
|
+
e.target.value = value.replace(/[0]+$/, '');
|
|
57
|
+
}
|
|
58
|
+
|
|
52
59
|
onChange && onChange(e);
|
|
53
60
|
}
|
|
54
61
|
};
|
|
@@ -75,7 +82,11 @@ Amount.formItemPropsHandler = function (_ref2) {
|
|
|
75
82
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
76
83
|
var value = e.target.value;
|
|
77
84
|
var str = value.replaceAll(seperator, '').replaceAll(/[^0-9\.]/g, '');
|
|
78
|
-
|
|
85
|
+
|
|
86
|
+
if (str.endsWith('.') || str.includes('.') && str.endsWith('0')) {
|
|
87
|
+
return str;
|
|
88
|
+
}
|
|
89
|
+
|
|
79
90
|
return str ? parseFloat(str) : undefined;
|
|
80
91
|
},
|
|
81
92
|
rules: [{
|
package/es/input/input-number.js
CHANGED
|
@@ -17,8 +17,15 @@ var IglooInputNumber = function IglooInputNumber(props) {
|
|
|
17
17
|
var value = props.value,
|
|
18
18
|
onChange = props.onChange;
|
|
19
19
|
|
|
20
|
-
if (typeof value === 'string'
|
|
21
|
-
|
|
20
|
+
if (typeof value === 'string') {
|
|
21
|
+
if (value.endsWith('.')) {
|
|
22
|
+
e.target.value = value.replace('.', '');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (value.endsWith('0') && value.includes('.')) {
|
|
26
|
+
e.target.value = value.replace(/[0]+$/, '');
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
onChange && onChange(e);
|
|
23
30
|
}
|
|
24
31
|
};
|
|
@@ -36,7 +43,11 @@ IglooInputNumber.formItemPropsHandler = function (config) {
|
|
|
36
43
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
37
44
|
var value = e.target.value;
|
|
38
45
|
var str = value.replaceAll(/[^0-9\.]/g, '');
|
|
39
|
-
|
|
46
|
+
|
|
47
|
+
if (str.endsWith('.') || str.includes('.') && str.endsWith('0')) {
|
|
48
|
+
return str;
|
|
49
|
+
}
|
|
50
|
+
|
|
40
51
|
return str ? parseFloat(str) : undefined;
|
|
41
52
|
}
|
|
42
53
|
};
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"Data Processed": "Data Processed",
|
|
22
22
|
"Data Processing...": "Data Processing...",
|
|
23
23
|
"Date": "Date",
|
|
24
|
+
"Done": "Done",
|
|
24
25
|
"Drag and drop a file here": "Drag and drop a file here",
|
|
25
26
|
"Edit": "Edit",
|
|
26
27
|
"Error Report": "Error Report",
|
|
@@ -56,10 +57,13 @@
|
|
|
56
57
|
"Result": "Result",
|
|
57
58
|
"Result: Success {success_num}; Error {fail_num}": "Result: Success {success_num}; Error {fail_num}",
|
|
58
59
|
"Rows per page": "Rows per page",
|
|
60
|
+
"Search": "Search",
|
|
61
|
+
"Searching...": "Searching...",
|
|
59
62
|
"Select All": "Select All",
|
|
60
63
|
"Send OTP": "Send OTP",
|
|
61
64
|
"Submit": "Submit",
|
|
62
65
|
"The file type is not supported.": "The file type is not supported.",
|
|
66
|
+
"There are no options available currently": "There are no options available currently",
|
|
63
67
|
"This Month": "This Month",
|
|
64
68
|
"Unselect All": "Unselect All",
|
|
65
69
|
"Uploading": "Uploading",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"Data Processed": "Data Terproses",
|
|
22
22
|
"Data Processing...": "Data Diproses",
|
|
23
23
|
"Date": "Tanggal",
|
|
24
|
+
"Done": "Selesai",
|
|
24
25
|
"Drag and drop a file here": "Geser dan Letakkan Dokumen disini",
|
|
25
26
|
"Edit": "Ubah",
|
|
26
27
|
"Error Report": "Laporan Kesalahan",
|
|
@@ -56,10 +57,13 @@
|
|
|
56
57
|
"Result": "Hasil",
|
|
57
58
|
"Result: Success {success_num}; Error {fail_num}": "Hasil: Sukses {success_num}; Kesalahan {fail_num}",
|
|
58
59
|
"Rows per page": "Baris per halaman",
|
|
60
|
+
"Search": "Mencari",
|
|
61
|
+
"Searching...": "Mencari...",
|
|
59
62
|
"Select All": "Pilih Semua",
|
|
60
63
|
"Send OTP": "Kirim OTP",
|
|
61
64
|
"Submit": "Ajukan",
|
|
62
65
|
"The file type is not supported.": "Jenis file tidak didukung.",
|
|
66
|
+
"There are no options available currently": "Tidak ada opsi yang tersedia saat ini",
|
|
63
67
|
"This Month": "Bulan ini",
|
|
64
68
|
"Unselect All": "Batalkan semua",
|
|
65
69
|
"Uploading": "Mengunggah",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"Data Processed": "ประมวลข้อมูลสำเร็จแล้ว",
|
|
22
22
|
"Data Processing...": "กำลังประมวลผลข้อมูล...",
|
|
23
23
|
"Date": "วันที่",
|
|
24
|
+
"Done": "เสร็จแล้ว",
|
|
24
25
|
"Drag and drop a file here": "ลากและวางไฟล์มาที่นี่",
|
|
25
26
|
"Edit": "แก้ไข",
|
|
26
27
|
"Error Report": "รายงานข้อผิดพลาด",
|
|
@@ -56,10 +57,13 @@
|
|
|
56
57
|
"Result": "ผลลัพธ์",
|
|
57
58
|
"Result: Success {success_num}; Error {fail_num}": "ผลลัพธ์: สำเร็จ {success_num}; ข้อผิดพลาด {fail_num}",
|
|
58
59
|
"Rows per page": "แถวต่อหน้า",
|
|
60
|
+
"Search": "ค้นหา",
|
|
61
|
+
"Searching...": "กำลังค้นหา...",
|
|
59
62
|
"Select All": "เลือกทั้งหมด",
|
|
60
63
|
"Send OTP": "ส่ง OTP",
|
|
61
64
|
"Submit": "ส่ง/ยืนยัน",
|
|
62
65
|
"The file type is not supported.": "ประเภทไฟล์ไม่รองรับ",
|
|
66
|
+
"There are no options available currently": "ไม่มีตัวเลือกในขณะนี้",
|
|
63
67
|
"This Month": "เดือนนี้",
|
|
64
68
|
"Unselect All": "ไม่เลือกทั้งหมด",
|
|
65
69
|
"Uploading": "กำลังอัพโหลด",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"Data Processed": "Dữ liệu đã xử lý",
|
|
22
22
|
"Data Processing...": "Đang xử lý dữ liệu...",
|
|
23
23
|
"Date": "Ngày",
|
|
24
|
+
"Done": "Xong",
|
|
24
25
|
"Drag and drop a file here": "Thả tệp tin vào đây",
|
|
25
26
|
"Edit": "Sửa",
|
|
26
27
|
"Error Report": "Báo cáo lỗi",
|
|
@@ -56,10 +57,13 @@
|
|
|
56
57
|
"Result": "Kết quả",
|
|
57
58
|
"Result: Success {success_num}; Error {fail_num}": "Kết quả: sự thành công {success_num}; lỗi {fail_num}",
|
|
58
59
|
"Rows per page": "Dòng trên trang",
|
|
60
|
+
"Search": "Tìm kiếm",
|
|
61
|
+
"Searching...": "Đang tìm kiếm...",
|
|
59
62
|
"Select All": "Chọn tất cả",
|
|
60
63
|
"Send OTP": "Gửi OTP",
|
|
61
64
|
"Submit": "Gửi",
|
|
62
65
|
"The file type is not supported.": "Loại tệp không được hỗ trợ.",
|
|
66
|
+
"There are no options available currently": "Hiện tại không có tùy chọn nào",
|
|
63
67
|
"This Month": "Tháng này",
|
|
64
68
|
"Unselect All": "Hủy chọn tất cả",
|
|
65
69
|
"Uploading": "Đang tải lên",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"Data Processed": "已导入",
|
|
22
22
|
"Data Processing...": "导入中",
|
|
23
23
|
"Date": "日期",
|
|
24
|
+
"Done": "完成",
|
|
24
25
|
"Drag and drop a file here": "拖拽一个文件到这里",
|
|
25
26
|
"Edit": "编辑",
|
|
26
27
|
"Error Report": "错误报告",
|
|
@@ -56,10 +57,13 @@
|
|
|
56
57
|
"Result": "结果",
|
|
57
58
|
"Result: Success {success_num}; Error {fail_num}": "结果:成功 {success_num}; 失败 {fail_num}",
|
|
58
59
|
"Rows per page": "每页条数",
|
|
60
|
+
"Search": "搜索",
|
|
61
|
+
"Searching...": "正在搜索...",
|
|
59
62
|
"Select All": "全选",
|
|
60
63
|
"Send OTP": "发送OTP",
|
|
61
64
|
"Submit": "提交",
|
|
62
65
|
"The file type is not supported.": "不支持上传该类型的文件。",
|
|
66
|
+
"There are no options available currently": "当前没有可用的选项",
|
|
63
67
|
"This Month": "当月",
|
|
64
68
|
"Unselect All": "反选",
|
|
65
69
|
"Uploading": "上传中",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"Data Processed": "數據已處理",
|
|
22
22
|
"Data Processing...": "數據處理中。。。",
|
|
23
23
|
"Date": "日期",
|
|
24
|
+
"Done": "完成",
|
|
24
25
|
"Drag and drop a file here": "拖放文件至此",
|
|
25
26
|
"Edit": "編輯",
|
|
26
27
|
"Error Report": "錯誤報告",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"OK": "好",
|
|
39
40
|
"Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "一旦您對上述內容感到滿意,您已檢查聲明,請繼續並提交您的索賠。",
|
|
40
41
|
"Optional": "可選項",
|
|
42
|
+
"Other Reason": "其他原因",
|
|
41
43
|
"Please enter a valid date.": "請輸入有效的日期。",
|
|
42
44
|
"Please enter a valid time.": "請輸入有效的時間。",
|
|
43
45
|
"Please select": "請選擇",
|
|
@@ -55,10 +57,13 @@
|
|
|
55
57
|
"Result": "結果",
|
|
56
58
|
"Result: Success {success_num}; Error {fail_num}": "結果:成功{success_num};錯誤{fail_num}",
|
|
57
59
|
"Rows per page": "每頁行數",
|
|
60
|
+
"Search": "檢索",
|
|
61
|
+
"Searching...": "正在檢索...",
|
|
58
62
|
"Select All": "全選",
|
|
59
63
|
"Send OTP": "發送OTP.",
|
|
60
64
|
"Submit": "提交",
|
|
61
65
|
"The file type is not supported.": "不支持文件類型。",
|
|
66
|
+
"There are no options available currently": "當前沒有可用的選項",
|
|
62
67
|
"This Month": "本月",
|
|
63
68
|
"Unselect All": "全部取消選擇",
|
|
64
69
|
"Uploading": "上傳",
|
package/es/radio/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { RadioProps, RadioGroupProps } from 'antd/es/radio';
|
|
2
2
|
import { FC, IglooComponentProps } from '../types';
|
|
3
3
|
import './style/index.less';
|
|
4
|
-
import {
|
|
4
|
+
import { ComponentProps } from '../utils/option-utils';
|
|
5
|
+
import { DefaultOptionType } from 'rc-select/lib/Select';
|
|
5
6
|
declare type Props = RadioProps & IglooComponentProps;
|
|
6
7
|
declare const IglooRadio: FC<Props>;
|
|
7
|
-
export interface Option extends
|
|
8
|
+
export interface Option extends DefaultOptionType {
|
|
8
9
|
extraInfo?: {
|
|
9
10
|
content: any;
|
|
10
11
|
shownTrigger: 'unchecked' | 'checked' | 'all';
|
|
11
12
|
};
|
|
12
|
-
label: any;
|
|
13
13
|
}
|
|
14
|
-
export interface IProps extends IglooComponentProps, Omit<RadioGroupProps, 'options'
|
|
14
|
+
export interface IProps extends IglooComponentProps, Omit<RadioGroupProps, 'options'>, ComponentProps {
|
|
15
15
|
className?: string;
|
|
16
16
|
radioType?: string;
|
|
17
|
-
getOptions?: (form: FormInstance) => Option[];
|
|
18
17
|
options: Option[];
|
|
19
18
|
}
|
|
20
|
-
export declare const
|
|
19
|
+
export declare const InnerRadioGroup: FC<IProps>;
|
|
20
|
+
export declare const RadioGroup: FC<import("../utils/option-utils").HOCProps & IProps>;
|
|
21
21
|
export default IglooRadio;
|
|
22
22
|
export { default as RadioGroupWithOther } from './radio-group-with-other';
|
package/es/radio/index.js
CHANGED
|
@@ -4,9 +4,21 @@ import "antd/es/row/style";
|
|
|
4
4
|
import _Row from "antd/es/row";
|
|
5
5
|
import "antd/es/radio/style";
|
|
6
6
|
import _Radio from "antd/es/radio";
|
|
7
|
-
var _excluded = ["className", "options", "radioType", "
|
|
7
|
+
var _excluded = ["className", "options", "radioType", "value", "clearWhenOptionsUpdated"],
|
|
8
8
|
_excluded2 = ["label", "value", "extraInfo"];
|
|
9
9
|
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
+
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
19
|
+
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
|
|
10
22
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
23
|
|
|
12
24
|
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; }
|
|
@@ -18,12 +30,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
18
30
|
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; }
|
|
19
31
|
|
|
20
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
-
import { useEffect } from 'react';
|
|
33
|
+
import { useEffect, useState, useRef, useContext } from 'react';
|
|
22
34
|
import omit from 'omit.js';
|
|
23
35
|
import classnames from 'classnames';
|
|
24
36
|
import formMethods from '../utils/form-methods';
|
|
25
37
|
import './style/index.less';
|
|
26
38
|
import Typography from '../typography';
|
|
39
|
+
import LocaleContext from '../locale/locale-context';
|
|
40
|
+
import emptyIcon from './style/empty.svg';
|
|
41
|
+
import { compareOptions, optionsHOC } from '../utils/option-utils';
|
|
27
42
|
|
|
28
43
|
var IglooRadio = function IglooRadio(props) {
|
|
29
44
|
return _jsx(_Radio, _objectSpread({}, omit(props, formMethods)));
|
|
@@ -33,38 +48,55 @@ IglooRadio.formItemPropsHandler = function () {
|
|
|
33
48
|
return {};
|
|
34
49
|
};
|
|
35
50
|
|
|
36
|
-
export var
|
|
51
|
+
export var InnerRadioGroup = function InnerRadioGroup(_ref) {
|
|
37
52
|
var className = _ref.className,
|
|
38
|
-
|
|
53
|
+
options = _ref.options,
|
|
39
54
|
_ref$radioType = _ref.radioType,
|
|
40
55
|
radioType = _ref$radioType === void 0 ? 'normal' : _ref$radioType,
|
|
41
|
-
getOptionsProp = _ref.getOptions,
|
|
42
56
|
value = _ref.value,
|
|
57
|
+
_ref$clearWhenOptions = _ref.clearWhenOptionsUpdated,
|
|
58
|
+
clearWhenOptionsUpdated = _ref$clearWhenOptions === void 0 ? false : _ref$clearWhenOptions,
|
|
43
59
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
60
|
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var options = typeof getOptionsProp === 'function' && getOptionsProp(form);
|
|
50
|
-
return options || [];
|
|
51
|
-
};
|
|
61
|
+
var _useState = useState(value),
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63
|
+
selected = _useState2[0],
|
|
64
|
+
setSelected = _useState2[1];
|
|
52
65
|
|
|
53
|
-
var
|
|
66
|
+
var originOptions = useRef(options);
|
|
67
|
+
|
|
68
|
+
var _useContext = useContext(LocaleContext),
|
|
69
|
+
formatMessage = _useContext.formatMessage;
|
|
70
|
+
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
typeof rest.onChange === 'function' && value !== selected && rest.onChange(selected);
|
|
73
|
+
}, [selected]);
|
|
74
|
+
useEffect(function () {
|
|
75
|
+
setSelected(value);
|
|
76
|
+
}, [value]);
|
|
54
77
|
useEffect(function () {
|
|
55
78
|
var setFieldValue = rest.setFieldValue;
|
|
56
|
-
var foundValue = options.find(function (option) {
|
|
57
|
-
return option.value === value;
|
|
58
|
-
});
|
|
59
79
|
|
|
60
|
-
if (
|
|
61
|
-
|
|
80
|
+
if (compareOptions(options, originOptions.current)) {
|
|
81
|
+
if (clearWhenOptionsUpdated) {
|
|
82
|
+
typeof setFieldValue === 'function' && setFieldValue();
|
|
83
|
+
} else {
|
|
84
|
+
var foundValue = options.find(function (option) {
|
|
85
|
+
return Array.isArray(value) ? value.includes(option.value) : option.value === value;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (!foundValue && value !== undefined) {
|
|
89
|
+
typeof setFieldValue === 'function' && setFieldValue();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
originOptions.current = options;
|
|
62
94
|
}
|
|
63
|
-
}, [
|
|
64
|
-
return
|
|
95
|
+
}, [options]);
|
|
96
|
+
return _jsxs(_Radio.Group, _objectSpread(_objectSpread({}, omit(rest, formMethods)), {}, {
|
|
65
97
|
className: classnames('igloo-radio-group', className),
|
|
66
98
|
value: value,
|
|
67
|
-
children: _jsx(_Row, {
|
|
99
|
+
children: [_jsx(_Row, {
|
|
68
100
|
gutter: [8, 8],
|
|
69
101
|
children: options.map(function (_ref2) {
|
|
70
102
|
var label = _ref2.label,
|
|
@@ -108,9 +140,34 @@ export var RadioGroup = function RadioGroup(_ref) {
|
|
|
108
140
|
}))
|
|
109
141
|
}, key);
|
|
110
142
|
})
|
|
111
|
-
})
|
|
143
|
+
}), !options.length && _jsxs("div", {
|
|
144
|
+
style: {
|
|
145
|
+
display: 'flex',
|
|
146
|
+
flexDirection: 'column',
|
|
147
|
+
background: '#f9f9f9',
|
|
148
|
+
padding: 16,
|
|
149
|
+
alignItems: 'center'
|
|
150
|
+
},
|
|
151
|
+
children: [_jsx("img", {
|
|
152
|
+
src: emptyIcon,
|
|
153
|
+
style: {
|
|
154
|
+
width: 32,
|
|
155
|
+
height: 24
|
|
156
|
+
}
|
|
157
|
+
}), _jsx(Typography, {
|
|
158
|
+
level: "h5",
|
|
159
|
+
style: {
|
|
160
|
+
color: '#212121',
|
|
161
|
+
marginTop: 8
|
|
162
|
+
},
|
|
163
|
+
children: formatMessage({
|
|
164
|
+
id: 'There are no options available currently'
|
|
165
|
+
})
|
|
166
|
+
})]
|
|
167
|
+
})]
|
|
112
168
|
}));
|
|
113
169
|
};
|
|
170
|
+
export var RadioGroup = optionsHOC(InnerRadioGroup);
|
|
114
171
|
|
|
115
172
|
RadioGroup.formItemPropsHandler = function () {
|
|
116
173
|
return {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IProps as RadioGroupProps } from './index';
|
|
2
2
|
import { FC } from '../types';
|
|
3
|
-
declare const RadioGroupWithOther: FC<RadioGroupProps & {
|
|
3
|
+
declare const RadioGroupWithOther: FC<import("../utils/option-utils").HOCProps & RadioGroupProps & {
|
|
4
4
|
otherOptionLabel: string;
|
|
5
5
|
}>;
|
|
6
6
|
export default RadioGroupWithOther;
|