iglooform 2.5.23 → 2.5.24
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/input/input.js +71 -1
- package/lib/input/input.js +72 -1
- package/package.json +1 -1
- package/es/example/index.d.ts +0 -3
- package/es/example/index.js +0 -119
- package/es/example/style/index.d.ts +0 -1
- package/es/example/style/index.js +0 -1
- package/es/example/style/index.less +0 -0
- package/lib/example/index.d.ts +0 -3
- package/lib/example/index.js +0 -142
- package/lib/example/style/index.d.ts +0 -1
- package/lib/example/style/index.js +0 -3
- package/lib/example/style/index.less +0 -0
package/es/input/input.js
CHANGED
|
@@ -11,6 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
import { forwardRef } from 'react';
|
|
12
12
|
import formMethods from '../utils/form-methods';
|
|
13
13
|
import omit from 'omit.js';
|
|
14
|
+
import { staticFormatMessage } from '@/locale';
|
|
14
15
|
import './style/index.less';
|
|
15
16
|
var IglooInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
16
17
|
return _jsx(_Input, _objectSpread(_objectSpread({
|
|
@@ -21,7 +22,76 @@ var IglooInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
22
|
});
|
|
22
23
|
|
|
23
24
|
IglooInput.formItemPropsHandler = function (config) {
|
|
24
|
-
|
|
25
|
+
var maxLength = config.maxLength,
|
|
26
|
+
minLength = config.minLength,
|
|
27
|
+
pattern = config.pattern,
|
|
28
|
+
label = config.label;
|
|
29
|
+
var rules = [];
|
|
30
|
+
|
|
31
|
+
if (maxLength !== undefined && minLength !== undefined) {
|
|
32
|
+
rules.push({
|
|
33
|
+
validator: function validator(_, value) {
|
|
34
|
+
if (value === undefined || value === null || String(value).length >= minLength && String(value).length <= maxLength) return Promise.resolve();
|
|
35
|
+
return Promise.reject(staticFormatMessage({
|
|
36
|
+
id: '{label} must be {minLength} - {maxLength} characters.',
|
|
37
|
+
values: {
|
|
38
|
+
maxLength: maxLength,
|
|
39
|
+
minLength: minLength,
|
|
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 <= maxLength) return Promise.resolve();
|
|
51
|
+
return Promise.reject(staticFormatMessage({
|
|
52
|
+
id: '{label} must be less than {maxLength} characters.',
|
|
53
|
+
values: {
|
|
54
|
+
maxLength: maxLength,
|
|
55
|
+
label: label
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (maxLength === undefined && minLength !== undefined) {
|
|
63
|
+
rules.push({
|
|
64
|
+
validator: function validator(_, value) {
|
|
65
|
+
if (value === undefined || value === null || String(value).length >= minLength) return Promise.resolve();
|
|
66
|
+
return Promise.reject(staticFormatMessage({
|
|
67
|
+
id: '{label} must be at least {minLength} characters.',
|
|
68
|
+
values: {
|
|
69
|
+
minLength: minLength,
|
|
70
|
+
label: label
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (pattern) {
|
|
78
|
+
rules.push({
|
|
79
|
+
validator: function validator(_, value) {
|
|
80
|
+
if (new RegExp(pattern).test(value)) return Promise.resolve();
|
|
81
|
+
return Promise.reject(staticFormatMessage({
|
|
82
|
+
id: '{label} must match ther pattern {pattern}.',
|
|
83
|
+
values: {
|
|
84
|
+
pattern: pattern,
|
|
85
|
+
label: label
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
rules: rules
|
|
94
|
+
};
|
|
25
95
|
};
|
|
26
96
|
|
|
27
97
|
export default IglooInput;
|
package/lib/input/input.js
CHANGED
|
@@ -17,6 +17,8 @@ var _formMethods = _interopRequireDefault(require("../utils/form-methods"));
|
|
|
17
17
|
|
|
18
18
|
var _omit = _interopRequireDefault(require("omit.js"));
|
|
19
19
|
|
|
20
|
+
var _locale = require("@/locale");
|
|
21
|
+
|
|
20
22
|
require("./style/index.less");
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -36,7 +38,76 @@ var IglooInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
IglooInput.formItemPropsHandler = function (config) {
|
|
39
|
-
|
|
41
|
+
var maxLength = config.maxLength,
|
|
42
|
+
minLength = config.minLength,
|
|
43
|
+
pattern = config.pattern,
|
|
44
|
+
label = config.label;
|
|
45
|
+
var rules = [];
|
|
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((0, _locale.staticFormatMessage)({
|
|
52
|
+
id: '{label} must be {minLength} - {maxLength} characters.',
|
|
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((0, _locale.staticFormatMessage)({
|
|
68
|
+
id: '{label} must be less than {maxLength} characters.',
|
|
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((0, _locale.staticFormatMessage)({
|
|
83
|
+
id: '{label} must be at least {minLength} characters.',
|
|
84
|
+
values: {
|
|
85
|
+
minLength: minLength,
|
|
86
|
+
label: label
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (pattern) {
|
|
94
|
+
rules.push({
|
|
95
|
+
validator: function validator(_, value) {
|
|
96
|
+
if (new RegExp(pattern).test(value)) return Promise.resolve();
|
|
97
|
+
return Promise.reject((0, _locale.staticFormatMessage)({
|
|
98
|
+
id: '{label} must match ther pattern {pattern}.',
|
|
99
|
+
values: {
|
|
100
|
+
pattern: pattern,
|
|
101
|
+
label: label
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
rules: rules
|
|
110
|
+
};
|
|
40
111
|
};
|
|
41
112
|
|
|
42
113
|
var _default = IglooInput;
|
package/package.json
CHANGED
package/es/example/index.d.ts
DELETED
package/es/example/index.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import "antd/es/button/style";
|
|
2
|
-
import _Button from "antd/es/button";
|
|
3
|
-
var _excluded = ["onSubmit"];
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
|
-
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; }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
-
|
|
17
|
-
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."); }
|
|
18
|
-
|
|
19
|
-
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); }
|
|
20
|
-
|
|
21
|
-
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; }
|
|
22
|
-
|
|
23
|
-
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; }
|
|
24
|
-
|
|
25
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
-
|
|
27
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
-
import React, { useState } from 'react';
|
|
29
|
-
import { RedoOutlined } from '@ant-design/icons';
|
|
30
|
-
import { LocaleProvider } from '../locale';
|
|
31
|
-
import Select from '../select';
|
|
32
|
-
import ReactJson from 'react-json-view';
|
|
33
|
-
|
|
34
|
-
var Excample = function Excample(_ref) {
|
|
35
|
-
var children = _ref.children;
|
|
36
|
-
|
|
37
|
-
var _useState = useState(),
|
|
38
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
-
result = _useState2[0],
|
|
40
|
-
setResult = _useState2[1];
|
|
41
|
-
|
|
42
|
-
var _useState3 = useState(0),
|
|
43
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
44
|
-
key = _useState4[0],
|
|
45
|
-
setKey = _useState4[1];
|
|
46
|
-
|
|
47
|
-
var _useState5 = useState('en-US'),
|
|
48
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
-
currentLang = _useState6[0],
|
|
50
|
-
setLang = _useState6[1];
|
|
51
|
-
|
|
52
|
-
var options = [{
|
|
53
|
-
label: 'en-US',
|
|
54
|
-
value: 'en-US'
|
|
55
|
-
}, {
|
|
56
|
-
label: 'id-ID',
|
|
57
|
-
value: 'id-ID'
|
|
58
|
-
}, {
|
|
59
|
-
label: 'th-TH',
|
|
60
|
-
value: 'th-TH'
|
|
61
|
-
}, {
|
|
62
|
-
label: 'vi-VN',
|
|
63
|
-
value: 'vi-VN'
|
|
64
|
-
}, {
|
|
65
|
-
label: 'zh-CN',
|
|
66
|
-
value: 'zh-CN'
|
|
67
|
-
}, {
|
|
68
|
-
label: 'zh-TW',
|
|
69
|
-
value: 'zh-TW'
|
|
70
|
-
}];
|
|
71
|
-
|
|
72
|
-
var _children$props = children.props,
|
|
73
|
-
onSubmit = _children$props.onSubmit,
|
|
74
|
-
rest = _objectWithoutProperties(_children$props, _excluded);
|
|
75
|
-
|
|
76
|
-
var handleSubmit = function handleSubmit(values) {
|
|
77
|
-
setResult(values);
|
|
78
|
-
|
|
79
|
-
if (typeof onSubmit === 'function') {
|
|
80
|
-
return onSubmit(values);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
return _jsxs(LocaleProvider, {
|
|
85
|
-
currentLang: currentLang,
|
|
86
|
-
children: [_jsx(_Button, {
|
|
87
|
-
onClick: function onClick() {
|
|
88
|
-
setKey(key + 1);
|
|
89
|
-
setResult(undefined);
|
|
90
|
-
},
|
|
91
|
-
shape: "circle",
|
|
92
|
-
icon: _jsx(RedoOutlined, {}),
|
|
93
|
-
type: "primary",
|
|
94
|
-
style: {
|
|
95
|
-
marginBottom: 16
|
|
96
|
-
}
|
|
97
|
-
}), _jsx(Select, {
|
|
98
|
-
defaultValue: currentLang,
|
|
99
|
-
style: {
|
|
100
|
-
width: 200,
|
|
101
|
-
marginLeft: 20
|
|
102
|
-
},
|
|
103
|
-
options: options,
|
|
104
|
-
onChange: function onChange(e) {
|
|
105
|
-
return setLang(e);
|
|
106
|
-
}
|
|
107
|
-
}), /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
|
|
108
|
-
onSubmit: handleSubmit,
|
|
109
|
-
key: key
|
|
110
|
-
})), result && _jsx(ReactJson, {
|
|
111
|
-
src: result,
|
|
112
|
-
displayDataTypes: false,
|
|
113
|
-
name: false,
|
|
114
|
-
displayObjectSize: false
|
|
115
|
-
})]
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export default Excample;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
|
File without changes
|
package/lib/example/index.d.ts
DELETED
package/lib/example/index.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
require("antd/es/button/style");
|
|
11
|
-
|
|
12
|
-
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
13
|
-
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
|
-
var _icons = require("@ant-design/icons");
|
|
19
|
-
|
|
20
|
-
var _locale = require("../locale");
|
|
21
|
-
|
|
22
|
-
var _select = _interopRequireDefault(require("../select"));
|
|
23
|
-
|
|
24
|
-
var _reactJsonView = _interopRequireDefault(require("react-json-view"));
|
|
25
|
-
|
|
26
|
-
var _excluded = ["onSubmit"];
|
|
27
|
-
|
|
28
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
-
|
|
32
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
38
|
-
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; }
|
|
39
|
-
|
|
40
|
-
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; }
|
|
41
|
-
|
|
42
|
-
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; }
|
|
43
|
-
|
|
44
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
45
|
-
|
|
46
|
-
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."); }
|
|
47
|
-
|
|
48
|
-
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); }
|
|
49
|
-
|
|
50
|
-
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; }
|
|
51
|
-
|
|
52
|
-
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; }
|
|
53
|
-
|
|
54
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
55
|
-
|
|
56
|
-
var Excample = function Excample(_ref) {
|
|
57
|
-
var children = _ref.children;
|
|
58
|
-
|
|
59
|
-
var _useState = (0, _react.useState)(),
|
|
60
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
61
|
-
result = _useState2[0],
|
|
62
|
-
setResult = _useState2[1];
|
|
63
|
-
|
|
64
|
-
var _useState3 = (0, _react.useState)(0),
|
|
65
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
66
|
-
key = _useState4[0],
|
|
67
|
-
setKey = _useState4[1];
|
|
68
|
-
|
|
69
|
-
var _useState5 = (0, _react.useState)('en-US'),
|
|
70
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
71
|
-
currentLang = _useState6[0],
|
|
72
|
-
setLang = _useState6[1];
|
|
73
|
-
|
|
74
|
-
var options = [{
|
|
75
|
-
label: 'en-US',
|
|
76
|
-
value: 'en-US'
|
|
77
|
-
}, {
|
|
78
|
-
label: 'id-ID',
|
|
79
|
-
value: 'id-ID'
|
|
80
|
-
}, {
|
|
81
|
-
label: 'th-TH',
|
|
82
|
-
value: 'th-TH'
|
|
83
|
-
}, {
|
|
84
|
-
label: 'vi-VN',
|
|
85
|
-
value: 'vi-VN'
|
|
86
|
-
}, {
|
|
87
|
-
label: 'zh-CN',
|
|
88
|
-
value: 'zh-CN'
|
|
89
|
-
}, {
|
|
90
|
-
label: 'zh-TW',
|
|
91
|
-
value: 'zh-TW'
|
|
92
|
-
}];
|
|
93
|
-
|
|
94
|
-
var _children$props = children.props,
|
|
95
|
-
onSubmit = _children$props.onSubmit,
|
|
96
|
-
rest = _objectWithoutProperties(_children$props, _excluded);
|
|
97
|
-
|
|
98
|
-
var handleSubmit = function handleSubmit(values) {
|
|
99
|
-
setResult(values);
|
|
100
|
-
|
|
101
|
-
if (typeof onSubmit === 'function') {
|
|
102
|
-
return onSubmit(values);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
return (0, _jsxRuntime.jsxs)(_locale.LocaleProvider, {
|
|
107
|
-
currentLang: currentLang,
|
|
108
|
-
children: [(0, _jsxRuntime.jsx)(_button.default, {
|
|
109
|
-
onClick: function onClick() {
|
|
110
|
-
setKey(key + 1);
|
|
111
|
-
setResult(undefined);
|
|
112
|
-
},
|
|
113
|
-
shape: "circle",
|
|
114
|
-
icon: (0, _jsxRuntime.jsx)(_icons.RedoOutlined, {}),
|
|
115
|
-
type: "primary",
|
|
116
|
-
style: {
|
|
117
|
-
marginBottom: 16
|
|
118
|
-
}
|
|
119
|
-
}), (0, _jsxRuntime.jsx)(_select.default, {
|
|
120
|
-
defaultValue: currentLang,
|
|
121
|
-
style: {
|
|
122
|
-
width: 200,
|
|
123
|
-
marginLeft: 20
|
|
124
|
-
},
|
|
125
|
-
options: options,
|
|
126
|
-
onChange: function onChange(e) {
|
|
127
|
-
return setLang(e);
|
|
128
|
-
}
|
|
129
|
-
}), /*#__PURE__*/_react.default.cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
|
|
130
|
-
onSubmit: handleSubmit,
|
|
131
|
-
key: key
|
|
132
|
-
})), result && (0, _jsxRuntime.jsx)(_reactJsonView.default, {
|
|
133
|
-
src: result,
|
|
134
|
-
displayDataTypes: false,
|
|
135
|
-
name: false,
|
|
136
|
-
displayObjectSize: false
|
|
137
|
-
})]
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
var _default = Excample;
|
|
142
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
|
File without changes
|