iglooform 2.4.21 → 2.4.25
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 +1 -1
- package/es/form/step/index.js +3 -2
- package/es/free-form/element/index.js +1 -1
- package/es/free-form/step/index.d.ts +1 -0
- package/es/free-form/step/index.js +4 -3
- package/es/input/credit-card.js +2 -1
- package/es/input/expiry-date.js +3 -1
- package/es/input/input-date.js +2 -1
- package/es/input/input-number.js +2 -2
- package/es/platform/platform-card/index.d.ts +4 -1
- package/es/platform/platform-card/index.js +4 -2
- package/es/platform/switch-platform/index.d.ts +4 -1
- package/es/platform/switch-platform/index.js +35 -4
- package/lib/form/element/index.js +1 -1
- package/lib/form/step/index.js +3 -2
- package/lib/free-form/element/index.js +1 -1
- package/lib/free-form/step/index.d.ts +1 -0
- package/lib/free-form/step/index.js +4 -3
- package/lib/input/credit-card.js +2 -1
- package/lib/input/expiry-date.js +3 -1
- package/lib/input/input-date.js +2 -1
- package/lib/input/input-number.js +2 -2
- package/lib/platform/platform-card/index.d.ts +4 -1
- package/lib/platform/platform-card/index.js +4 -2
- package/lib/platform/switch-platform/index.d.ts +4 -1
- package/lib/platform/switch-platform/index.js +34 -3
- package/package.json +1 -1
package/es/form/element/index.js
CHANGED
|
@@ -308,7 +308,7 @@ var Element = function Element(_ref) {
|
|
|
308
308
|
children: [error && !!error.length && _jsx(AlertFilled, {
|
|
309
309
|
className: "igloo-element-preview-value-icon"
|
|
310
310
|
}, void 0), _jsx("div", {
|
|
311
|
-
children: previewFormater ? previewFormater(value, form) : JSON.stringify(value)
|
|
311
|
+
children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
|
|
312
312
|
}, void 0)]
|
|
313
313
|
}, void 0)]
|
|
314
314
|
}, void 0)
|
package/es/form/step/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var Step = function Step(_ref) {
|
|
|
43
43
|
editButtonLabel = _ref$config.editButtonLabel,
|
|
44
44
|
getButtonDisabledState = _ref$config.getButtonDisabledState,
|
|
45
45
|
disableEditButton = _ref$config.disableEditButton,
|
|
46
|
+
buttonText = _ref$config.buttonText,
|
|
46
47
|
edit = _ref.edit,
|
|
47
48
|
preview = _ref.preview,
|
|
48
49
|
index = _ref.index,
|
|
@@ -139,7 +140,7 @@ var Step = function Step(_ref) {
|
|
|
139
140
|
className: 'igloo-step-button',
|
|
140
141
|
type: "primary",
|
|
141
142
|
disabled: buttonDisabled,
|
|
142
|
-
children: continueText || formatMessage({
|
|
143
|
+
children: buttonText || continueText || formatMessage({
|
|
143
144
|
id: 'Continue'
|
|
144
145
|
})
|
|
145
146
|
}, void 0)
|
|
@@ -153,7 +154,7 @@ var Step = function Step(_ref) {
|
|
|
153
154
|
className: 'igloo-step-button',
|
|
154
155
|
loading: submitting,
|
|
155
156
|
disabled: buttonDisabled,
|
|
156
|
-
children: submitText || formatMessage({
|
|
157
|
+
children: buttonText || submitText || formatMessage({
|
|
157
158
|
id: 'Submit'
|
|
158
159
|
})
|
|
159
160
|
}, void 0)
|
|
@@ -263,7 +263,7 @@ var Element = function Element(props) {
|
|
|
263
263
|
children: [error && !!error.length && _jsx(AlertFilled, {
|
|
264
264
|
className: "igloo-freeform-element-preview-value-icon"
|
|
265
265
|
}, void 0), _jsx("div", {
|
|
266
|
-
children: previewFormater ? previewFormater(value, form) : JSON.stringify(value)
|
|
266
|
+
children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
|
|
267
267
|
}, void 0)]
|
|
268
268
|
}, void 0)]
|
|
269
269
|
}, void 0)
|
|
@@ -60,7 +60,8 @@ var Step = function Step(_ref) {
|
|
|
60
60
|
shouldScroll = _ref.shouldScroll,
|
|
61
61
|
children = _ref.children,
|
|
62
62
|
shouldRender = _ref.shouldRender,
|
|
63
|
-
subscribedFields = _ref.subscribedFields
|
|
63
|
+
subscribedFields = _ref.subscribedFields,
|
|
64
|
+
buttonText = _ref.buttonText;
|
|
64
65
|
|
|
65
66
|
var _useContext = useContext(LocaleContext),
|
|
66
67
|
formatMessage = _useContext.formatMessage;
|
|
@@ -261,7 +262,7 @@ var Step = function Step(_ref) {
|
|
|
261
262
|
className: 'igloo-freeform-step-button',
|
|
262
263
|
type: "primary",
|
|
263
264
|
disabled: buttonDisabled,
|
|
264
|
-
children: continueText || formatMessage({
|
|
265
|
+
children: buttonText || continueText || formatMessage({
|
|
265
266
|
id: 'Continue'
|
|
266
267
|
})
|
|
267
268
|
}, void 0)
|
|
@@ -275,7 +276,7 @@ var Step = function Step(_ref) {
|
|
|
275
276
|
className: 'igloo-freeform-step-button',
|
|
276
277
|
loading: submitting,
|
|
277
278
|
disabled: buttonDisabled,
|
|
278
|
-
children: submitText || formatMessage({
|
|
279
|
+
children: buttonText || submitText || formatMessage({
|
|
279
280
|
id: 'Submit'
|
|
280
281
|
})
|
|
281
282
|
}, void 0)
|
package/es/input/credit-card.js
CHANGED
|
@@ -172,6 +172,7 @@ var IglooCredit = function IglooCredit(props) {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
formOnChange && formOnChange('error type');
|
|
175
176
|
setFieldError && setFieldError(formatMessage({
|
|
176
177
|
id: 'Credit card must be {typeNames} or {finalName}',
|
|
177
178
|
values: getErrorMessage(cardRules)
|
|
@@ -179,7 +180,7 @@ var IglooCredit = function IglooCredit(props) {
|
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
useEffect(function () {
|
|
182
|
-
if (value) {
|
|
183
|
+
if (value && value !== 'error type') {
|
|
183
184
|
handleOnChange(value, [].concat(_toConsumableArray(cardConfig), defaultCheck), formChangeProps);
|
|
184
185
|
}
|
|
185
186
|
}, [value]);
|
package/es/input/expiry-date.js
CHANGED
|
@@ -100,7 +100,8 @@ var IglooExpiryDate = function IglooExpiryDate(props) {
|
|
|
100
100
|
setInput = _useState4[1];
|
|
101
101
|
|
|
102
102
|
useEffect(function () {
|
|
103
|
-
if (!value) return;
|
|
103
|
+
if (!value || typeof value === 'string') return; //=== string 就是value='error type'
|
|
104
|
+
|
|
104
105
|
setInput(value);
|
|
105
106
|
inputValueRef.current = value;
|
|
106
107
|
}, [value.year, value.month]);
|
|
@@ -119,6 +120,7 @@ var IglooExpiryDate = function IglooExpiryDate(props) {
|
|
|
119
120
|
if (userCheck && compCheck) {
|
|
120
121
|
onChangeProps && onChangeProps(value);
|
|
121
122
|
} else {
|
|
123
|
+
onChangeProps && onChangeProps('error type');
|
|
122
124
|
setFieldError && setFieldError(formatMessage({
|
|
123
125
|
id: 'Please enter a valid date.'
|
|
124
126
|
}));
|
package/es/input/input-date.js
CHANGED
|
@@ -105,7 +105,7 @@ var IglooInputDate = function IglooInputDate(props) {
|
|
|
105
105
|
formatMessage = _useContext.formatMessage;
|
|
106
106
|
|
|
107
107
|
useEffect(function () {
|
|
108
|
-
if (!value) return;
|
|
108
|
+
if (!value || value === 'error type') return;
|
|
109
109
|
var init = value.split(delimiter);
|
|
110
110
|
setInput(init);
|
|
111
111
|
inputValueRef.current = init;
|
|
@@ -119,6 +119,7 @@ var IglooInputDate = function IglooInputDate(props) {
|
|
|
119
119
|
if (available) {
|
|
120
120
|
onChangeProps && onChangeProps(value);
|
|
121
121
|
} else {
|
|
122
|
+
onChangeProps && onChangeProps('error type');
|
|
122
123
|
setFieldError && setFieldError(formatMessage({
|
|
123
124
|
id: 'Please enter a valid date.'
|
|
124
125
|
}));
|
package/es/input/input-number.js
CHANGED
|
@@ -36,8 +36,8 @@ IglooInputNumber.formItemPropsHandler = function (config) {
|
|
|
36
36
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
37
37
|
var value = e.target.value;
|
|
38
38
|
var str = value.replaceAll(/[^0-9\.]/g, '');
|
|
39
|
-
if (value.endsWith('.')) return str;
|
|
40
|
-
return str ? parseFloat(str) :
|
|
39
|
+
if (value.endsWith('.')) return parseInt(str);
|
|
40
|
+
return str ? parseFloat(str) : undefined;
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
};
|
|
@@ -30,6 +30,8 @@ var PlatformCard = function PlatformCard(_ref) {
|
|
|
30
30
|
showDefault = _useState2[0],
|
|
31
31
|
setShowDefault = _useState2[1];
|
|
32
32
|
|
|
33
|
+
var key = typeof platform === 'string' ? platform : platform.key;
|
|
34
|
+
var name = typeof platform === 'string' ? platform : platform.name;
|
|
33
35
|
return _jsxs("div", {
|
|
34
36
|
className: classnames('igloo-platform', className),
|
|
35
37
|
onClick: onClick,
|
|
@@ -43,12 +45,12 @@ var PlatformCard = function PlatformCard(_ref) {
|
|
|
43
45
|
className: "igloo-platform-defaultLogo"
|
|
44
46
|
}, void 0), _jsx("div", {
|
|
45
47
|
className: "igloo-platform-name",
|
|
46
|
-
children:
|
|
48
|
+
children: name
|
|
47
49
|
}, void 0)]
|
|
48
50
|
}, void 0), !showDefault && _jsx(_Image, {
|
|
49
51
|
width: 200,
|
|
50
52
|
height: 200,
|
|
51
|
-
src: "https://static.iglooinsure.com/partner/normal/".concat(
|
|
53
|
+
src: "https://static.iglooinsure.com/partner/normal/".concat(key.toLowerCase(), ".svg"),
|
|
52
54
|
onError: function onError() {
|
|
53
55
|
return setShowDefault(true);
|
|
54
56
|
},
|
|
@@ -7,6 +7,8 @@ import _Menu from "antd/es/menu";
|
|
|
7
7
|
import "antd/es/dropdown/style";
|
|
8
8
|
import _Dropdown from "antd/es/dropdown";
|
|
9
9
|
|
|
10
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
11
|
+
|
|
10
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
13
|
|
|
12
14
|
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."); }
|
|
@@ -20,7 +22,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
20
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
23
|
|
|
22
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
-
import { useState } from 'react';
|
|
25
|
+
import { useState, useMemo } from 'react';
|
|
24
26
|
import defaultIcon from '../square/default.svg';
|
|
25
27
|
import { ArrowDownOutlined } from 'iglooicon';
|
|
26
28
|
import './style/index.less';
|
|
@@ -40,12 +42,41 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
|
|
|
40
42
|
onChange(e.key);
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
var currentName = useMemo(function () {
|
|
46
|
+
var name = currentPlatform;
|
|
47
|
+
|
|
48
|
+
var _iterator = _createForOfIteratorHelper(platforms),
|
|
49
|
+
_step;
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
53
|
+
var platform = _step.value;
|
|
54
|
+
|
|
55
|
+
if (typeof platform === 'string') {
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (platform.key === currentPlatform) {
|
|
60
|
+
name = platform.name;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} catch (err) {
|
|
65
|
+
_iterator.e(err);
|
|
66
|
+
} finally {
|
|
67
|
+
_iterator.f();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return name;
|
|
71
|
+
}, [platforms, currentPlatform]);
|
|
43
72
|
return _jsx(_Dropdown, {
|
|
44
73
|
className: "igloo-switch-platform",
|
|
45
74
|
trigger: ['click'],
|
|
46
75
|
overlay: _jsx(_Menu, {
|
|
47
76
|
onClick: handleChange,
|
|
48
|
-
children: platforms === null || platforms === void 0 ? void 0 : platforms.map(function (
|
|
77
|
+
children: platforms === null || platforms === void 0 ? void 0 : platforms.map(function (platform) {
|
|
78
|
+
var name = typeof platform === 'string' ? platform : platform.name;
|
|
79
|
+
var key = typeof platform === 'string' ? platform : platform.key;
|
|
49
80
|
return _jsxs(_Menu.Item, {
|
|
50
81
|
className: "igloo-switch-platform-option",
|
|
51
82
|
children: [_jsx(_Image, {
|
|
@@ -57,7 +88,7 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
|
|
|
57
88
|
className: "igloo-switch-platform-name",
|
|
58
89
|
children: name
|
|
59
90
|
}, void 0)]
|
|
60
|
-
},
|
|
91
|
+
}, key);
|
|
61
92
|
})
|
|
62
93
|
}, void 0),
|
|
63
94
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
@@ -84,7 +115,7 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
|
|
|
84
115
|
className: "igloo-switch-platform-default-logo"
|
|
85
116
|
}, void 0), _jsx("span", {
|
|
86
117
|
className: "igloo-switch-platform-name",
|
|
87
|
-
children:
|
|
118
|
+
children: currentName
|
|
88
119
|
}, void 0)]
|
|
89
120
|
}, void 0)
|
|
90
121
|
}, void 0), _jsx(ArrowDownOutlined, {
|
|
@@ -337,7 +337,7 @@ var Element = function Element(_ref) {
|
|
|
337
337
|
children: [error && !!error.length && (0, _jsxRuntime.jsx)(_iglooicon.AlertFilled, {
|
|
338
338
|
className: "igloo-element-preview-value-icon"
|
|
339
339
|
}, void 0), (0, _jsxRuntime.jsx)("div", {
|
|
340
|
-
children: previewFormater ? previewFormater(value, form) : JSON.stringify(value)
|
|
340
|
+
children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
|
|
341
341
|
}, void 0)]
|
|
342
342
|
}, void 0)]
|
|
343
343
|
}, void 0)
|
package/lib/form/step/index.js
CHANGED
|
@@ -67,6 +67,7 @@ var Step = function Step(_ref) {
|
|
|
67
67
|
editButtonLabel = _ref$config.editButtonLabel,
|
|
68
68
|
getButtonDisabledState = _ref$config.getButtonDisabledState,
|
|
69
69
|
disableEditButton = _ref$config.disableEditButton,
|
|
70
|
+
buttonText = _ref$config.buttonText,
|
|
70
71
|
edit = _ref.edit,
|
|
71
72
|
preview = _ref.preview,
|
|
72
73
|
index = _ref.index,
|
|
@@ -163,7 +164,7 @@ var Step = function Step(_ref) {
|
|
|
163
164
|
className: 'igloo-step-button',
|
|
164
165
|
type: "primary",
|
|
165
166
|
disabled: buttonDisabled,
|
|
166
|
-
children: continueText || formatMessage({
|
|
167
|
+
children: buttonText || continueText || formatMessage({
|
|
167
168
|
id: 'Continue'
|
|
168
169
|
})
|
|
169
170
|
}, void 0)
|
|
@@ -177,7 +178,7 @@ var Step = function Step(_ref) {
|
|
|
177
178
|
className: 'igloo-step-button',
|
|
178
179
|
loading: submitting,
|
|
179
180
|
disabled: buttonDisabled,
|
|
180
|
-
children: submitText || formatMessage({
|
|
181
|
+
children: buttonText || submitText || formatMessage({
|
|
181
182
|
id: 'Submit'
|
|
182
183
|
})
|
|
183
184
|
}, void 0)
|
|
@@ -289,7 +289,7 @@ var Element = function Element(props) {
|
|
|
289
289
|
children: [error && !!error.length && (0, _jsxRuntime.jsx)(_iglooicon.AlertFilled, {
|
|
290
290
|
className: "igloo-freeform-element-preview-value-icon"
|
|
291
291
|
}, void 0), (0, _jsxRuntime.jsx)("div", {
|
|
292
|
-
children: previewFormater ? previewFormater(value, form) : JSON.stringify(value)
|
|
292
|
+
children: previewFormater ? previewFormater(value, form) : _typeof(value) === 'object' ? JSON.stringify(value) : value
|
|
293
293
|
}, void 0)]
|
|
294
294
|
}, void 0)]
|
|
295
295
|
}, void 0)
|
|
@@ -83,7 +83,8 @@ var Step = function Step(_ref) {
|
|
|
83
83
|
shouldScroll = _ref.shouldScroll,
|
|
84
84
|
children = _ref.children,
|
|
85
85
|
shouldRender = _ref.shouldRender,
|
|
86
|
-
subscribedFields = _ref.subscribedFields
|
|
86
|
+
subscribedFields = _ref.subscribedFields,
|
|
87
|
+
buttonText = _ref.buttonText;
|
|
87
88
|
|
|
88
89
|
var _useContext = (0, _react.useContext)(_locale.LocaleContext),
|
|
89
90
|
formatMessage = _useContext.formatMessage;
|
|
@@ -284,7 +285,7 @@ var Step = function Step(_ref) {
|
|
|
284
285
|
className: 'igloo-freeform-step-button',
|
|
285
286
|
type: "primary",
|
|
286
287
|
disabled: buttonDisabled,
|
|
287
|
-
children: continueText || formatMessage({
|
|
288
|
+
children: buttonText || continueText || formatMessage({
|
|
288
289
|
id: 'Continue'
|
|
289
290
|
})
|
|
290
291
|
}, void 0)
|
|
@@ -298,7 +299,7 @@ var Step = function Step(_ref) {
|
|
|
298
299
|
className: 'igloo-freeform-step-button',
|
|
299
300
|
loading: submitting,
|
|
300
301
|
disabled: buttonDisabled,
|
|
301
|
-
children: submitText || formatMessage({
|
|
302
|
+
children: buttonText || submitText || formatMessage({
|
|
302
303
|
id: 'Submit'
|
|
303
304
|
})
|
|
304
305
|
}, void 0)
|
package/lib/input/credit-card.js
CHANGED
|
@@ -187,6 +187,7 @@ var IglooCredit = function IglooCredit(props) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
formOnChange && formOnChange('error type');
|
|
190
191
|
setFieldError && setFieldError(formatMessage({
|
|
191
192
|
id: 'Credit card must be {typeNames} or {finalName}',
|
|
192
193
|
values: getErrorMessage(cardRules)
|
|
@@ -194,7 +195,7 @@ var IglooCredit = function IglooCredit(props) {
|
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
(0, _react.useEffect)(function () {
|
|
197
|
-
if (value) {
|
|
198
|
+
if (value && value !== 'error type') {
|
|
198
199
|
handleOnChange(value, [].concat(_toConsumableArray(cardConfig), defaultCheck), formChangeProps);
|
|
199
200
|
}
|
|
200
201
|
}, [value]);
|
package/lib/input/expiry-date.js
CHANGED
|
@@ -116,7 +116,8 @@ var IglooExpiryDate = function IglooExpiryDate(props) {
|
|
|
116
116
|
setInput = _useState4[1];
|
|
117
117
|
|
|
118
118
|
(0, _react.useEffect)(function () {
|
|
119
|
-
if (!value) return;
|
|
119
|
+
if (!value || typeof value === 'string') return; //=== string 就是value='error type'
|
|
120
|
+
|
|
120
121
|
setInput(value);
|
|
121
122
|
inputValueRef.current = value;
|
|
122
123
|
}, [value.year, value.month]);
|
|
@@ -135,6 +136,7 @@ var IglooExpiryDate = function IglooExpiryDate(props) {
|
|
|
135
136
|
if (userCheck && compCheck) {
|
|
136
137
|
onChangeProps && onChangeProps(value);
|
|
137
138
|
} else {
|
|
139
|
+
onChangeProps && onChangeProps('error type');
|
|
138
140
|
setFieldError && setFieldError(formatMessage({
|
|
139
141
|
id: 'Please enter a valid date.'
|
|
140
142
|
}));
|
package/lib/input/input-date.js
CHANGED
|
@@ -122,7 +122,7 @@ var IglooInputDate = function IglooInputDate(props) {
|
|
|
122
122
|
formatMessage = _useContext.formatMessage;
|
|
123
123
|
|
|
124
124
|
(0, _react.useEffect)(function () {
|
|
125
|
-
if (!value) return;
|
|
125
|
+
if (!value || value === 'error type') return;
|
|
126
126
|
var init = value.split(delimiter);
|
|
127
127
|
setInput(init);
|
|
128
128
|
inputValueRef.current = init;
|
|
@@ -136,6 +136,7 @@ var IglooInputDate = function IglooInputDate(props) {
|
|
|
136
136
|
if (available) {
|
|
137
137
|
onChangeProps && onChangeProps(value);
|
|
138
138
|
} else {
|
|
139
|
+
onChangeProps && onChangeProps('error type');
|
|
139
140
|
setFieldError && setFieldError(formatMessage({
|
|
140
141
|
id: 'Please enter a valid date.'
|
|
141
142
|
}));
|
|
@@ -49,8 +49,8 @@ IglooInputNumber.formItemPropsHandler = function (config) {
|
|
|
49
49
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
50
50
|
var value = e.target.value;
|
|
51
51
|
var str = value.replaceAll(/[^0-9\.]/g, '');
|
|
52
|
-
if (value.endsWith('.')) return str;
|
|
53
|
-
return str ? parseFloat(str) :
|
|
52
|
+
if (value.endsWith('.')) return parseInt(str);
|
|
53
|
+
return str ? parseFloat(str) : undefined;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
};
|
|
@@ -44,6 +44,8 @@ var PlatformCard = function PlatformCard(_ref) {
|
|
|
44
44
|
showDefault = _useState2[0],
|
|
45
45
|
setShowDefault = _useState2[1];
|
|
46
46
|
|
|
47
|
+
var key = typeof platform === 'string' ? platform : platform.key;
|
|
48
|
+
var name = typeof platform === 'string' ? platform : platform.name;
|
|
47
49
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
48
50
|
className: (0, _classnames.default)('igloo-platform', className),
|
|
49
51
|
onClick: onClick,
|
|
@@ -57,12 +59,12 @@ var PlatformCard = function PlatformCard(_ref) {
|
|
|
57
59
|
className: "igloo-platform-defaultLogo"
|
|
58
60
|
}, void 0), (0, _jsxRuntime.jsx)("div", {
|
|
59
61
|
className: "igloo-platform-name",
|
|
60
|
-
children:
|
|
62
|
+
children: name
|
|
61
63
|
}, void 0)]
|
|
62
64
|
}, void 0), !showDefault && (0, _jsxRuntime.jsx)(_image.default, {
|
|
63
65
|
width: 200,
|
|
64
66
|
height: 200,
|
|
65
|
-
src: "https://static.iglooinsure.com/partner/normal/".concat(
|
|
67
|
+
src: "https://static.iglooinsure.com/partner/normal/".concat(key.toLowerCase(), ".svg"),
|
|
66
68
|
onError: function onError() {
|
|
67
69
|
return setShowDefault(true);
|
|
68
70
|
},
|
|
@@ -33,6 +33,8 @@ require("./style/index.less");
|
|
|
33
33
|
|
|
34
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
35
|
|
|
36
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
37
|
+
|
|
36
38
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
39
|
|
|
38
40
|
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."); }
|
|
@@ -60,12 +62,41 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
|
|
|
60
62
|
onChange(e.key);
|
|
61
63
|
};
|
|
62
64
|
|
|
65
|
+
var currentName = (0, _react.useMemo)(function () {
|
|
66
|
+
var name = currentPlatform;
|
|
67
|
+
|
|
68
|
+
var _iterator = _createForOfIteratorHelper(platforms),
|
|
69
|
+
_step;
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
73
|
+
var platform = _step.value;
|
|
74
|
+
|
|
75
|
+
if (typeof platform === 'string') {
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (platform.key === currentPlatform) {
|
|
80
|
+
name = platform.name;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
_iterator.e(err);
|
|
86
|
+
} finally {
|
|
87
|
+
_iterator.f();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return name;
|
|
91
|
+
}, [platforms, currentPlatform]);
|
|
63
92
|
return (0, _jsxRuntime.jsx)(_dropdown.default, {
|
|
64
93
|
className: "igloo-switch-platform",
|
|
65
94
|
trigger: ['click'],
|
|
66
95
|
overlay: (0, _jsxRuntime.jsx)(_menu.default, {
|
|
67
96
|
onClick: handleChange,
|
|
68
|
-
children: platforms === null || platforms === void 0 ? void 0 : platforms.map(function (
|
|
97
|
+
children: platforms === null || platforms === void 0 ? void 0 : platforms.map(function (platform) {
|
|
98
|
+
var name = typeof platform === 'string' ? platform : platform.name;
|
|
99
|
+
var key = typeof platform === 'string' ? platform : platform.key;
|
|
69
100
|
return (0, _jsxRuntime.jsxs)(_menu.default.Item, {
|
|
70
101
|
className: "igloo-switch-platform-option",
|
|
71
102
|
children: [(0, _jsxRuntime.jsx)(_image.default, {
|
|
@@ -77,7 +108,7 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
|
|
|
77
108
|
className: "igloo-switch-platform-name",
|
|
78
109
|
children: name
|
|
79
110
|
}, void 0)]
|
|
80
|
-
},
|
|
111
|
+
}, key);
|
|
81
112
|
})
|
|
82
113
|
}, void 0),
|
|
83
114
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
@@ -104,7 +135,7 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
|
|
|
104
135
|
className: "igloo-switch-platform-default-logo"
|
|
105
136
|
}, void 0), (0, _jsxRuntime.jsx)("span", {
|
|
106
137
|
className: "igloo-switch-platform-name",
|
|
107
|
-
children:
|
|
138
|
+
children: currentName
|
|
108
139
|
}, void 0)]
|
|
109
140
|
}, void 0)
|
|
110
141
|
}, void 0), (0, _jsxRuntime.jsx)(_iglooicon.ArrowDownOutlined, {
|