@kne/react-form-antd 3.1.5 → 4.0.0-alpha.0
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/README.md +8 -12
- package/dist/index.css +0 -40
- package/dist/index.css.map +1 -1
- package/dist/index.js +1251 -751
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1263 -702
- package/dist/index.modern.js.map +1 -1
- package/package.json +19 -33
package/dist/index.js
CHANGED
|
@@ -1,46 +1,19 @@
|
|
|
1
1
|
var React = require('react');
|
|
2
|
-
var PropTypes = require('prop-types');
|
|
3
2
|
var classnames = require('classnames');
|
|
4
3
|
var ReactForm = require('@kne/react-form');
|
|
5
4
|
var reactFormHelper = require('@kne/react-form-helper');
|
|
6
|
-
var
|
|
5
|
+
var merge = require('lodash/merge');
|
|
7
6
|
var antd = require('antd');
|
|
8
|
-
var icons = require('@ant-design/icons');
|
|
9
|
-
var withLayer = require('@kne/with-layer');
|
|
10
|
-
var AvatarEditor = require('react-avatar-editor');
|
|
11
|
-
var useEvent = require('@kne/use-event');
|
|
12
|
-
var reactFetch = require('@kne/react-fetch');
|
|
13
7
|
var dayjs = require('dayjs');
|
|
8
|
+
var lodash = require('lodash');
|
|
14
9
|
var useControlValue = require('@kne/use-control-value');
|
|
15
10
|
|
|
16
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
12
|
|
|
18
|
-
function _interopNamespace(e) {
|
|
19
|
-
if (e && e.__esModule) return e;
|
|
20
|
-
var n = Object.create(null);
|
|
21
|
-
if (e) {
|
|
22
|
-
Object.keys(e).forEach(function (k) {
|
|
23
|
-
if (k !== 'default') {
|
|
24
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () { return e[k]; }
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
n["default"] = e;
|
|
33
|
-
return n;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
37
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
38
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
39
14
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
40
15
|
var ReactForm__default = /*#__PURE__*/_interopDefaultLegacy(ReactForm);
|
|
41
|
-
var
|
|
42
|
-
var AvatarEditor__default = /*#__PURE__*/_interopDefaultLegacy(AvatarEditor);
|
|
43
|
-
var useEvent__default = /*#__PURE__*/_interopDefaultLegacy(useEvent);
|
|
16
|
+
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
44
17
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
45
18
|
var useControlValue__default = /*#__PURE__*/_interopDefaultLegacy(useControlValue);
|
|
46
19
|
|
|
@@ -57,12 +30,1163 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
57
30
|
if (null == r) return {};
|
|
58
31
|
var t = {};
|
|
59
32
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
60
|
-
if (e.
|
|
33
|
+
if (e.includes(n)) continue;
|
|
61
34
|
t[n] = r[n];
|
|
62
35
|
}
|
|
63
36
|
return t;
|
|
64
37
|
}
|
|
65
38
|
|
|
39
|
+
function createCommonjsModule(fn) {
|
|
40
|
+
var module = { exports: {} };
|
|
41
|
+
return fn(module, module.exports), module.exports;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** @license React v16.13.1
|
|
45
|
+
* react-is.production.min.js
|
|
46
|
+
*
|
|
47
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the MIT license found in the
|
|
50
|
+
* LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/
|
|
52
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
53
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
54
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
|
|
55
|
+
var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
|
|
56
|
+
var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
|
|
57
|
+
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
|
|
58
|
+
|
|
59
|
+
var reactIs_production_min = {
|
|
60
|
+
AsyncMode: AsyncMode,
|
|
61
|
+
ConcurrentMode: ConcurrentMode,
|
|
62
|
+
ContextConsumer: ContextConsumer,
|
|
63
|
+
ContextProvider: ContextProvider,
|
|
64
|
+
Element: Element,
|
|
65
|
+
ForwardRef: ForwardRef,
|
|
66
|
+
Fragment: Fragment,
|
|
67
|
+
Lazy: Lazy,
|
|
68
|
+
Memo: Memo,
|
|
69
|
+
Portal: Portal,
|
|
70
|
+
Profiler: Profiler,
|
|
71
|
+
StrictMode: StrictMode,
|
|
72
|
+
Suspense: Suspense,
|
|
73
|
+
isAsyncMode: isAsyncMode,
|
|
74
|
+
isConcurrentMode: isConcurrentMode,
|
|
75
|
+
isContextConsumer: isContextConsumer,
|
|
76
|
+
isContextProvider: isContextProvider,
|
|
77
|
+
isElement: isElement,
|
|
78
|
+
isForwardRef: isForwardRef,
|
|
79
|
+
isFragment: isFragment,
|
|
80
|
+
isLazy: isLazy,
|
|
81
|
+
isMemo: isMemo,
|
|
82
|
+
isPortal: isPortal,
|
|
83
|
+
isProfiler: isProfiler,
|
|
84
|
+
isStrictMode: isStrictMode,
|
|
85
|
+
isSuspense: isSuspense,
|
|
86
|
+
isValidElementType: isValidElementType,
|
|
87
|
+
typeOf: typeOf
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/** @license React v16.13.1
|
|
91
|
+
* react-is.development.js
|
|
92
|
+
*
|
|
93
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
94
|
+
*
|
|
95
|
+
* This source code is licensed under the MIT license found in the
|
|
96
|
+
* LICENSE file in the root directory of this source tree.
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
if (process.env.NODE_ENV !== "production") {
|
|
104
|
+
(function() {
|
|
105
|
+
|
|
106
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
107
|
+
// nor polyfill, then a plain number is used for performance.
|
|
108
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
109
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
110
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
111
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
112
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
113
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
114
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
115
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
116
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
117
|
+
|
|
118
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
119
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
120
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
121
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
122
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
123
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
124
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
125
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
126
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
127
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
128
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
129
|
+
|
|
130
|
+
function isValidElementType(type) {
|
|
131
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
132
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function typeOf(object) {
|
|
136
|
+
if (typeof object === 'object' && object !== null) {
|
|
137
|
+
var $$typeof = object.$$typeof;
|
|
138
|
+
|
|
139
|
+
switch ($$typeof) {
|
|
140
|
+
case REACT_ELEMENT_TYPE:
|
|
141
|
+
var type = object.type;
|
|
142
|
+
|
|
143
|
+
switch (type) {
|
|
144
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
145
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
146
|
+
case REACT_FRAGMENT_TYPE:
|
|
147
|
+
case REACT_PROFILER_TYPE:
|
|
148
|
+
case REACT_STRICT_MODE_TYPE:
|
|
149
|
+
case REACT_SUSPENSE_TYPE:
|
|
150
|
+
return type;
|
|
151
|
+
|
|
152
|
+
default:
|
|
153
|
+
var $$typeofType = type && type.$$typeof;
|
|
154
|
+
|
|
155
|
+
switch ($$typeofType) {
|
|
156
|
+
case REACT_CONTEXT_TYPE:
|
|
157
|
+
case REACT_FORWARD_REF_TYPE:
|
|
158
|
+
case REACT_LAZY_TYPE:
|
|
159
|
+
case REACT_MEMO_TYPE:
|
|
160
|
+
case REACT_PROVIDER_TYPE:
|
|
161
|
+
return $$typeofType;
|
|
162
|
+
|
|
163
|
+
default:
|
|
164
|
+
return $$typeof;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
case REACT_PORTAL_TYPE:
|
|
170
|
+
return $$typeof;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return undefined;
|
|
175
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
176
|
+
|
|
177
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
178
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
179
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
180
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
181
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
182
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
183
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
184
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
185
|
+
var Memo = REACT_MEMO_TYPE;
|
|
186
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
187
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
188
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
189
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
190
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
191
|
+
|
|
192
|
+
function isAsyncMode(object) {
|
|
193
|
+
{
|
|
194
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
195
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
196
|
+
|
|
197
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
202
|
+
}
|
|
203
|
+
function isConcurrentMode(object) {
|
|
204
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
205
|
+
}
|
|
206
|
+
function isContextConsumer(object) {
|
|
207
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
208
|
+
}
|
|
209
|
+
function isContextProvider(object) {
|
|
210
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
211
|
+
}
|
|
212
|
+
function isElement(object) {
|
|
213
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
214
|
+
}
|
|
215
|
+
function isForwardRef(object) {
|
|
216
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
217
|
+
}
|
|
218
|
+
function isFragment(object) {
|
|
219
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
220
|
+
}
|
|
221
|
+
function isLazy(object) {
|
|
222
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
223
|
+
}
|
|
224
|
+
function isMemo(object) {
|
|
225
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
226
|
+
}
|
|
227
|
+
function isPortal(object) {
|
|
228
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
229
|
+
}
|
|
230
|
+
function isProfiler(object) {
|
|
231
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
232
|
+
}
|
|
233
|
+
function isStrictMode(object) {
|
|
234
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
235
|
+
}
|
|
236
|
+
function isSuspense(object) {
|
|
237
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
exports.AsyncMode = AsyncMode;
|
|
241
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
242
|
+
exports.ContextConsumer = ContextConsumer;
|
|
243
|
+
exports.ContextProvider = ContextProvider;
|
|
244
|
+
exports.Element = Element;
|
|
245
|
+
exports.ForwardRef = ForwardRef;
|
|
246
|
+
exports.Fragment = Fragment;
|
|
247
|
+
exports.Lazy = Lazy;
|
|
248
|
+
exports.Memo = Memo;
|
|
249
|
+
exports.Portal = Portal;
|
|
250
|
+
exports.Profiler = Profiler;
|
|
251
|
+
exports.StrictMode = StrictMode;
|
|
252
|
+
exports.Suspense = Suspense;
|
|
253
|
+
exports.isAsyncMode = isAsyncMode;
|
|
254
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
255
|
+
exports.isContextConsumer = isContextConsumer;
|
|
256
|
+
exports.isContextProvider = isContextProvider;
|
|
257
|
+
exports.isElement = isElement;
|
|
258
|
+
exports.isForwardRef = isForwardRef;
|
|
259
|
+
exports.isFragment = isFragment;
|
|
260
|
+
exports.isLazy = isLazy;
|
|
261
|
+
exports.isMemo = isMemo;
|
|
262
|
+
exports.isPortal = isPortal;
|
|
263
|
+
exports.isProfiler = isProfiler;
|
|
264
|
+
exports.isStrictMode = isStrictMode;
|
|
265
|
+
exports.isSuspense = isSuspense;
|
|
266
|
+
exports.isValidElementType = isValidElementType;
|
|
267
|
+
exports.typeOf = typeOf;
|
|
268
|
+
})();
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
var reactIs = createCommonjsModule(function (module) {
|
|
273
|
+
|
|
274
|
+
if (process.env.NODE_ENV === 'production') {
|
|
275
|
+
module.exports = reactIs_production_min;
|
|
276
|
+
} else {
|
|
277
|
+
module.exports = reactIs_development;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
/*
|
|
282
|
+
object-assign
|
|
283
|
+
(c) Sindre Sorhus
|
|
284
|
+
@license MIT
|
|
285
|
+
*/
|
|
286
|
+
/* eslint-disable no-unused-vars */
|
|
287
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
288
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
289
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
290
|
+
|
|
291
|
+
function toObject(val) {
|
|
292
|
+
if (val === null || val === undefined) {
|
|
293
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return Object(val);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function shouldUseNative() {
|
|
300
|
+
try {
|
|
301
|
+
if (!Object.assign) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
306
|
+
|
|
307
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
308
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
309
|
+
test1[5] = 'de';
|
|
310
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
315
|
+
var test2 = {};
|
|
316
|
+
for (var i = 0; i < 10; i++) {
|
|
317
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
318
|
+
}
|
|
319
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
320
|
+
return test2[n];
|
|
321
|
+
});
|
|
322
|
+
if (order2.join('') !== '0123456789') {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
327
|
+
var test3 = {};
|
|
328
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
329
|
+
test3[letter] = letter;
|
|
330
|
+
});
|
|
331
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
332
|
+
'abcdefghijklmnopqrst') {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return true;
|
|
337
|
+
} catch (err) {
|
|
338
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
344
|
+
var from;
|
|
345
|
+
var to = toObject(target);
|
|
346
|
+
var symbols;
|
|
347
|
+
|
|
348
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
349
|
+
from = Object(arguments[s]);
|
|
350
|
+
|
|
351
|
+
for (var key in from) {
|
|
352
|
+
if (hasOwnProperty.call(from, key)) {
|
|
353
|
+
to[key] = from[key];
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (getOwnPropertySymbols) {
|
|
358
|
+
symbols = getOwnPropertySymbols(from);
|
|
359
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
360
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
361
|
+
to[symbols[i]] = from[symbols[i]];
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return to;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
372
|
+
*
|
|
373
|
+
* This source code is licensed under the MIT license found in the
|
|
374
|
+
* LICENSE file in the root directory of this source tree.
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
var ReactPropTypesSecret$2 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
378
|
+
|
|
379
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$2;
|
|
380
|
+
|
|
381
|
+
var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
382
|
+
|
|
383
|
+
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
384
|
+
|
|
385
|
+
var has$1 = has$2;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
389
|
+
*
|
|
390
|
+
* This source code is licensed under the MIT license found in the
|
|
391
|
+
* LICENSE file in the root directory of this source tree.
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
var printWarning$1 = function() {};
|
|
395
|
+
|
|
396
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
397
|
+
var ReactPropTypesSecret = ReactPropTypesSecret$1;
|
|
398
|
+
var loggedTypeFailures = {};
|
|
399
|
+
var has = has$1;
|
|
400
|
+
|
|
401
|
+
printWarning$1 = function(text) {
|
|
402
|
+
var message = 'Warning: ' + text;
|
|
403
|
+
if (typeof console !== 'undefined') {
|
|
404
|
+
console.error(message);
|
|
405
|
+
}
|
|
406
|
+
try {
|
|
407
|
+
// --- Welcome to debugging React ---
|
|
408
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
409
|
+
// to find the callsite that caused this warning to fire.
|
|
410
|
+
throw new Error(message);
|
|
411
|
+
} catch (x) { /**/ }
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Assert that the values match with the type specs.
|
|
417
|
+
* Error messages are memorized and will only be shown once.
|
|
418
|
+
*
|
|
419
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
420
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
421
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
422
|
+
* @param {string} componentName Name of the component for error messages.
|
|
423
|
+
* @param {?Function} getStack Returns the component stack.
|
|
424
|
+
* @private
|
|
425
|
+
*/
|
|
426
|
+
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
427
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
428
|
+
for (var typeSpecName in typeSpecs) {
|
|
429
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
430
|
+
var error;
|
|
431
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
432
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
433
|
+
// After these have been cleaned up, we'll let them throw.
|
|
434
|
+
try {
|
|
435
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
436
|
+
// behavior as without this statement except with a better message.
|
|
437
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
438
|
+
var err = Error(
|
|
439
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
440
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
441
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
442
|
+
);
|
|
443
|
+
err.name = 'Invariant Violation';
|
|
444
|
+
throw err;
|
|
445
|
+
}
|
|
446
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
447
|
+
} catch (ex) {
|
|
448
|
+
error = ex;
|
|
449
|
+
}
|
|
450
|
+
if (error && !(error instanceof Error)) {
|
|
451
|
+
printWarning$1(
|
|
452
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
453
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
454
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
455
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
456
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
457
|
+
'shape all require an argument).'
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
461
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
462
|
+
// same error.
|
|
463
|
+
loggedTypeFailures[error.message] = true;
|
|
464
|
+
|
|
465
|
+
var stack = getStack ? getStack() : '';
|
|
466
|
+
|
|
467
|
+
printWarning$1(
|
|
468
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Resets warning cache when testing.
|
|
478
|
+
*
|
|
479
|
+
* @private
|
|
480
|
+
*/
|
|
481
|
+
checkPropTypes$1.resetWarningCache = function() {
|
|
482
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
483
|
+
loggedTypeFailures = {};
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
var checkPropTypes_1 = checkPropTypes$1;
|
|
488
|
+
|
|
489
|
+
var checkPropTypes = checkPropTypes_1;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the MIT license found in the
|
|
495
|
+
* LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
var printWarning = function() {};
|
|
506
|
+
|
|
507
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
508
|
+
printWarning = function(text) {
|
|
509
|
+
var message = 'Warning: ' + text;
|
|
510
|
+
if (typeof console !== 'undefined') {
|
|
511
|
+
console.error(message);
|
|
512
|
+
}
|
|
513
|
+
try {
|
|
514
|
+
// --- Welcome to debugging React ---
|
|
515
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
516
|
+
// to find the callsite that caused this warning to fire.
|
|
517
|
+
throw new Error(message);
|
|
518
|
+
} catch (x) {}
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function emptyFunctionThatReturnsNull() {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
527
|
+
/* global Symbol */
|
|
528
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
529
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Returns the iterator method function contained on the iterable object.
|
|
533
|
+
*
|
|
534
|
+
* Be sure to invoke the function with the iterable as context:
|
|
535
|
+
*
|
|
536
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
537
|
+
* if (iteratorFn) {
|
|
538
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
539
|
+
* ...
|
|
540
|
+
* }
|
|
541
|
+
*
|
|
542
|
+
* @param {?object} maybeIterable
|
|
543
|
+
* @return {?function}
|
|
544
|
+
*/
|
|
545
|
+
function getIteratorFn(maybeIterable) {
|
|
546
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
547
|
+
if (typeof iteratorFn === 'function') {
|
|
548
|
+
return iteratorFn;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
554
|
+
* supplied to React components. Example usage:
|
|
555
|
+
*
|
|
556
|
+
* var Props = require('ReactPropTypes');
|
|
557
|
+
* var MyArticle = React.createClass({
|
|
558
|
+
* propTypes: {
|
|
559
|
+
* // An optional string prop named "description".
|
|
560
|
+
* description: Props.string,
|
|
561
|
+
*
|
|
562
|
+
* // A required enum prop named "category".
|
|
563
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
564
|
+
*
|
|
565
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
566
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
567
|
+
* },
|
|
568
|
+
* render: function() { ... }
|
|
569
|
+
* });
|
|
570
|
+
*
|
|
571
|
+
* A more formal specification of how these methods are used:
|
|
572
|
+
*
|
|
573
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
574
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
575
|
+
*
|
|
576
|
+
* Each and every declaration produces a function with the same signature. This
|
|
577
|
+
* allows the creation of custom validation functions. For example:
|
|
578
|
+
*
|
|
579
|
+
* var MyLink = React.createClass({
|
|
580
|
+
* propTypes: {
|
|
581
|
+
* // An optional string or URI prop named "href".
|
|
582
|
+
* href: function(props, propName, componentName) {
|
|
583
|
+
* var propValue = props[propName];
|
|
584
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
585
|
+
* !(propValue instanceof URI)) {
|
|
586
|
+
* return new Error(
|
|
587
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
588
|
+
* componentName
|
|
589
|
+
* );
|
|
590
|
+
* }
|
|
591
|
+
* }
|
|
592
|
+
* },
|
|
593
|
+
* render: function() {...}
|
|
594
|
+
* });
|
|
595
|
+
*
|
|
596
|
+
* @internal
|
|
597
|
+
*/
|
|
598
|
+
|
|
599
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
600
|
+
|
|
601
|
+
// Important!
|
|
602
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
603
|
+
var ReactPropTypes = {
|
|
604
|
+
array: createPrimitiveTypeChecker('array'),
|
|
605
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
606
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
607
|
+
func: createPrimitiveTypeChecker('function'),
|
|
608
|
+
number: createPrimitiveTypeChecker('number'),
|
|
609
|
+
object: createPrimitiveTypeChecker('object'),
|
|
610
|
+
string: createPrimitiveTypeChecker('string'),
|
|
611
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
612
|
+
|
|
613
|
+
any: createAnyTypeChecker(),
|
|
614
|
+
arrayOf: createArrayOfTypeChecker,
|
|
615
|
+
element: createElementTypeChecker(),
|
|
616
|
+
elementType: createElementTypeTypeChecker(),
|
|
617
|
+
instanceOf: createInstanceTypeChecker,
|
|
618
|
+
node: createNodeChecker(),
|
|
619
|
+
objectOf: createObjectOfTypeChecker,
|
|
620
|
+
oneOf: createEnumTypeChecker,
|
|
621
|
+
oneOfType: createUnionTypeChecker,
|
|
622
|
+
shape: createShapeTypeChecker,
|
|
623
|
+
exact: createStrictShapeTypeChecker,
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
628
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
629
|
+
*/
|
|
630
|
+
/*eslint-disable no-self-compare*/
|
|
631
|
+
function is(x, y) {
|
|
632
|
+
// SameValue algorithm
|
|
633
|
+
if (x === y) {
|
|
634
|
+
// Steps 1-5, 7-10
|
|
635
|
+
// Steps 6.b-6.e: +0 != -0
|
|
636
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
637
|
+
} else {
|
|
638
|
+
// Step 6.a: NaN == NaN
|
|
639
|
+
return x !== x && y !== y;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
/*eslint-enable no-self-compare*/
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
646
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
647
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
648
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
649
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
650
|
+
*/
|
|
651
|
+
function PropTypeError(message, data) {
|
|
652
|
+
this.message = message;
|
|
653
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
654
|
+
this.stack = '';
|
|
655
|
+
}
|
|
656
|
+
// Make `instanceof Error` still work for returned errors.
|
|
657
|
+
PropTypeError.prototype = Error.prototype;
|
|
658
|
+
|
|
659
|
+
function createChainableTypeChecker(validate) {
|
|
660
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
661
|
+
var manualPropTypeCallCache = {};
|
|
662
|
+
var manualPropTypeWarningCount = 0;
|
|
663
|
+
}
|
|
664
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
665
|
+
componentName = componentName || ANONYMOUS;
|
|
666
|
+
propFullName = propFullName || propName;
|
|
667
|
+
|
|
668
|
+
if (secret !== ReactPropTypesSecret$1) {
|
|
669
|
+
if (throwOnDirectAccess) {
|
|
670
|
+
// New behavior only for users of `prop-types` package
|
|
671
|
+
var err = new Error(
|
|
672
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
673
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
674
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
675
|
+
);
|
|
676
|
+
err.name = 'Invariant Violation';
|
|
677
|
+
throw err;
|
|
678
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
679
|
+
// Old behavior for people using React.PropTypes
|
|
680
|
+
var cacheKey = componentName + ':' + propName;
|
|
681
|
+
if (
|
|
682
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
683
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
684
|
+
manualPropTypeWarningCount < 3
|
|
685
|
+
) {
|
|
686
|
+
printWarning(
|
|
687
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
688
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
689
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
690
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
691
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
692
|
+
);
|
|
693
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
694
|
+
manualPropTypeWarningCount++;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
if (props[propName] == null) {
|
|
699
|
+
if (isRequired) {
|
|
700
|
+
if (props[propName] === null) {
|
|
701
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
702
|
+
}
|
|
703
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
704
|
+
}
|
|
705
|
+
return null;
|
|
706
|
+
} else {
|
|
707
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
712
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
713
|
+
|
|
714
|
+
return chainedCheckType;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
718
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
719
|
+
var propValue = props[propName];
|
|
720
|
+
var propType = getPropType(propValue);
|
|
721
|
+
if (propType !== expectedType) {
|
|
722
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
723
|
+
// check, but we can offer a more precise error message here rather than
|
|
724
|
+
// 'of type `object`'.
|
|
725
|
+
var preciseType = getPreciseType(propValue);
|
|
726
|
+
|
|
727
|
+
return new PropTypeError(
|
|
728
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
729
|
+
{expectedType: expectedType}
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
return null;
|
|
733
|
+
}
|
|
734
|
+
return createChainableTypeChecker(validate);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
function createAnyTypeChecker() {
|
|
738
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
742
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
743
|
+
if (typeof typeChecker !== 'function') {
|
|
744
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
745
|
+
}
|
|
746
|
+
var propValue = props[propName];
|
|
747
|
+
if (!Array.isArray(propValue)) {
|
|
748
|
+
var propType = getPropType(propValue);
|
|
749
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
750
|
+
}
|
|
751
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
752
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
|
|
753
|
+
if (error instanceof Error) {
|
|
754
|
+
return error;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return null;
|
|
758
|
+
}
|
|
759
|
+
return createChainableTypeChecker(validate);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function createElementTypeChecker() {
|
|
763
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
764
|
+
var propValue = props[propName];
|
|
765
|
+
if (!isValidElement(propValue)) {
|
|
766
|
+
var propType = getPropType(propValue);
|
|
767
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
768
|
+
}
|
|
769
|
+
return null;
|
|
770
|
+
}
|
|
771
|
+
return createChainableTypeChecker(validate);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
function createElementTypeTypeChecker() {
|
|
775
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
776
|
+
var propValue = props[propName];
|
|
777
|
+
if (!reactIs.isValidElementType(propValue)) {
|
|
778
|
+
var propType = getPropType(propValue);
|
|
779
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
780
|
+
}
|
|
781
|
+
return null;
|
|
782
|
+
}
|
|
783
|
+
return createChainableTypeChecker(validate);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
787
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
788
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
789
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
790
|
+
var actualClassName = getClassName(props[propName]);
|
|
791
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
792
|
+
}
|
|
793
|
+
return null;
|
|
794
|
+
}
|
|
795
|
+
return createChainableTypeChecker(validate);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function createEnumTypeChecker(expectedValues) {
|
|
799
|
+
if (!Array.isArray(expectedValues)) {
|
|
800
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
801
|
+
if (arguments.length > 1) {
|
|
802
|
+
printWarning(
|
|
803
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
804
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
805
|
+
);
|
|
806
|
+
} else {
|
|
807
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
return emptyFunctionThatReturnsNull;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
814
|
+
var propValue = props[propName];
|
|
815
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
816
|
+
if (is(propValue, expectedValues[i])) {
|
|
817
|
+
return null;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
822
|
+
var type = getPreciseType(value);
|
|
823
|
+
if (type === 'symbol') {
|
|
824
|
+
return String(value);
|
|
825
|
+
}
|
|
826
|
+
return value;
|
|
827
|
+
});
|
|
828
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
829
|
+
}
|
|
830
|
+
return createChainableTypeChecker(validate);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
834
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
835
|
+
if (typeof typeChecker !== 'function') {
|
|
836
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
837
|
+
}
|
|
838
|
+
var propValue = props[propName];
|
|
839
|
+
var propType = getPropType(propValue);
|
|
840
|
+
if (propType !== 'object') {
|
|
841
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
842
|
+
}
|
|
843
|
+
for (var key in propValue) {
|
|
844
|
+
if (has$1(propValue, key)) {
|
|
845
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
846
|
+
if (error instanceof Error) {
|
|
847
|
+
return error;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
return createChainableTypeChecker(validate);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
857
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
858
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
859
|
+
return emptyFunctionThatReturnsNull;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
863
|
+
var checker = arrayOfTypeCheckers[i];
|
|
864
|
+
if (typeof checker !== 'function') {
|
|
865
|
+
printWarning(
|
|
866
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
867
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
868
|
+
);
|
|
869
|
+
return emptyFunctionThatReturnsNull;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
874
|
+
var expectedTypes = [];
|
|
875
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
876
|
+
var checker = arrayOfTypeCheckers[i];
|
|
877
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
|
|
878
|
+
if (checkerResult == null) {
|
|
879
|
+
return null;
|
|
880
|
+
}
|
|
881
|
+
if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
|
|
882
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
886
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
887
|
+
}
|
|
888
|
+
return createChainableTypeChecker(validate);
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
function createNodeChecker() {
|
|
892
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
893
|
+
if (!isNode(props[propName])) {
|
|
894
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
895
|
+
}
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
898
|
+
return createChainableTypeChecker(validate);
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
902
|
+
return new PropTypeError(
|
|
903
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
904
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
909
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
910
|
+
var propValue = props[propName];
|
|
911
|
+
var propType = getPropType(propValue);
|
|
912
|
+
if (propType !== 'object') {
|
|
913
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
914
|
+
}
|
|
915
|
+
for (var key in shapeTypes) {
|
|
916
|
+
var checker = shapeTypes[key];
|
|
917
|
+
if (typeof checker !== 'function') {
|
|
918
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
919
|
+
}
|
|
920
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
921
|
+
if (error) {
|
|
922
|
+
return error;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
return null;
|
|
926
|
+
}
|
|
927
|
+
return createChainableTypeChecker(validate);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
931
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
932
|
+
var propValue = props[propName];
|
|
933
|
+
var propType = getPropType(propValue);
|
|
934
|
+
if (propType !== 'object') {
|
|
935
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
936
|
+
}
|
|
937
|
+
// We need to check all keys in case some are required but missing from props.
|
|
938
|
+
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
939
|
+
for (var key in allKeys) {
|
|
940
|
+
var checker = shapeTypes[key];
|
|
941
|
+
if (has$1(shapeTypes, key) && typeof checker !== 'function') {
|
|
942
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
943
|
+
}
|
|
944
|
+
if (!checker) {
|
|
945
|
+
return new PropTypeError(
|
|
946
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
947
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
948
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
952
|
+
if (error) {
|
|
953
|
+
return error;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
return createChainableTypeChecker(validate);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
function isNode(propValue) {
|
|
963
|
+
switch (typeof propValue) {
|
|
964
|
+
case 'number':
|
|
965
|
+
case 'string':
|
|
966
|
+
case 'undefined':
|
|
967
|
+
return true;
|
|
968
|
+
case 'boolean':
|
|
969
|
+
return !propValue;
|
|
970
|
+
case 'object':
|
|
971
|
+
if (Array.isArray(propValue)) {
|
|
972
|
+
return propValue.every(isNode);
|
|
973
|
+
}
|
|
974
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
975
|
+
return true;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
979
|
+
if (iteratorFn) {
|
|
980
|
+
var iterator = iteratorFn.call(propValue);
|
|
981
|
+
var step;
|
|
982
|
+
if (iteratorFn !== propValue.entries) {
|
|
983
|
+
while (!(step = iterator.next()).done) {
|
|
984
|
+
if (!isNode(step.value)) {
|
|
985
|
+
return false;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
} else {
|
|
989
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
990
|
+
while (!(step = iterator.next()).done) {
|
|
991
|
+
var entry = step.value;
|
|
992
|
+
if (entry) {
|
|
993
|
+
if (!isNode(entry[1])) {
|
|
994
|
+
return false;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
} else {
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
return true;
|
|
1004
|
+
default:
|
|
1005
|
+
return false;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
function isSymbol(propType, propValue) {
|
|
1010
|
+
// Native Symbol.
|
|
1011
|
+
if (propType === 'symbol') {
|
|
1012
|
+
return true;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// falsy value can't be a Symbol
|
|
1016
|
+
if (!propValue) {
|
|
1017
|
+
return false;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1021
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1022
|
+
return true;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1026
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1027
|
+
return true;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
return false;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1034
|
+
function getPropType(propValue) {
|
|
1035
|
+
var propType = typeof propValue;
|
|
1036
|
+
if (Array.isArray(propValue)) {
|
|
1037
|
+
return 'array';
|
|
1038
|
+
}
|
|
1039
|
+
if (propValue instanceof RegExp) {
|
|
1040
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1041
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1042
|
+
// passes PropTypes.object.
|
|
1043
|
+
return 'object';
|
|
1044
|
+
}
|
|
1045
|
+
if (isSymbol(propType, propValue)) {
|
|
1046
|
+
return 'symbol';
|
|
1047
|
+
}
|
|
1048
|
+
return propType;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
1052
|
+
// See `createPrimitiveTypeChecker`.
|
|
1053
|
+
function getPreciseType(propValue) {
|
|
1054
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1055
|
+
return '' + propValue;
|
|
1056
|
+
}
|
|
1057
|
+
var propType = getPropType(propValue);
|
|
1058
|
+
if (propType === 'object') {
|
|
1059
|
+
if (propValue instanceof Date) {
|
|
1060
|
+
return 'date';
|
|
1061
|
+
} else if (propValue instanceof RegExp) {
|
|
1062
|
+
return 'regexp';
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
return propType;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1069
|
+
// For example, "undefined" or "of type array"
|
|
1070
|
+
function getPostfixForTypeWarning(value) {
|
|
1071
|
+
var type = getPreciseType(value);
|
|
1072
|
+
switch (type) {
|
|
1073
|
+
case 'array':
|
|
1074
|
+
case 'object':
|
|
1075
|
+
return 'an ' + type;
|
|
1076
|
+
case 'boolean':
|
|
1077
|
+
case 'date':
|
|
1078
|
+
case 'regexp':
|
|
1079
|
+
return 'a ' + type;
|
|
1080
|
+
default:
|
|
1081
|
+
return type;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// Returns class name of the object, if any.
|
|
1086
|
+
function getClassName(propValue) {
|
|
1087
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1088
|
+
return ANONYMOUS;
|
|
1089
|
+
}
|
|
1090
|
+
return propValue.constructor.name;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1094
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1095
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1096
|
+
|
|
1097
|
+
return ReactPropTypes;
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1102
|
+
*
|
|
1103
|
+
* This source code is licensed under the MIT license found in the
|
|
1104
|
+
* LICENSE file in the root directory of this source tree.
|
|
1105
|
+
*/
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
function emptyFunction() {}
|
|
1110
|
+
function emptyFunctionWithReset() {}
|
|
1111
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1112
|
+
|
|
1113
|
+
var factoryWithThrowingShims = function() {
|
|
1114
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1115
|
+
if (secret === ReactPropTypesSecret$1) {
|
|
1116
|
+
// It is still safe when called from React.
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
var err = new Error(
|
|
1120
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1121
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1122
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
1123
|
+
);
|
|
1124
|
+
err.name = 'Invariant Violation';
|
|
1125
|
+
throw err;
|
|
1126
|
+
} shim.isRequired = shim;
|
|
1127
|
+
function getShim() {
|
|
1128
|
+
return shim;
|
|
1129
|
+
} // Important!
|
|
1130
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1131
|
+
var ReactPropTypes = {
|
|
1132
|
+
array: shim,
|
|
1133
|
+
bigint: shim,
|
|
1134
|
+
bool: shim,
|
|
1135
|
+
func: shim,
|
|
1136
|
+
number: shim,
|
|
1137
|
+
object: shim,
|
|
1138
|
+
string: shim,
|
|
1139
|
+
symbol: shim,
|
|
1140
|
+
|
|
1141
|
+
any: shim,
|
|
1142
|
+
arrayOf: getShim,
|
|
1143
|
+
element: shim,
|
|
1144
|
+
elementType: shim,
|
|
1145
|
+
instanceOf: getShim,
|
|
1146
|
+
node: shim,
|
|
1147
|
+
objectOf: getShim,
|
|
1148
|
+
oneOf: getShim,
|
|
1149
|
+
oneOfType: getShim,
|
|
1150
|
+
shape: getShim,
|
|
1151
|
+
exact: getShim,
|
|
1152
|
+
|
|
1153
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1154
|
+
resetWarningCache: emptyFunction
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1158
|
+
|
|
1159
|
+
return ReactPropTypes;
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
var require$$1 = factoryWithTypeCheckers;
|
|
1163
|
+
|
|
1164
|
+
var require$$2 = factoryWithThrowingShims;
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1168
|
+
*
|
|
1169
|
+
* This source code is licensed under the MIT license found in the
|
|
1170
|
+
* LICENSE file in the root directory of this source tree.
|
|
1171
|
+
*/
|
|
1172
|
+
|
|
1173
|
+
var propTypes = createCommonjsModule(function (module) {
|
|
1174
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1175
|
+
var ReactIs = reactIs;
|
|
1176
|
+
|
|
1177
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1178
|
+
// http://fb.me/prop-types-in-prod
|
|
1179
|
+
var throwOnDirectAccess = true;
|
|
1180
|
+
module.exports = require$$1(ReactIs.isElement, throwOnDirectAccess);
|
|
1181
|
+
} else {
|
|
1182
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1183
|
+
// http://fb.me/prop-types-in-prod
|
|
1184
|
+
module.exports = require$$2();
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
|
|
1188
|
+
var PropTypes = propTypes;
|
|
1189
|
+
|
|
66
1190
|
var globalParams = {
|
|
67
1191
|
type: 'default',
|
|
68
1192
|
size: 'middle',
|
|
@@ -70,35 +1194,11 @@ var globalParams = {
|
|
|
70
1194
|
formModal: {},
|
|
71
1195
|
resetButton: {},
|
|
72
1196
|
submitButton: {},
|
|
73
|
-
field: {
|
|
74
|
-
upload: {
|
|
75
|
-
displayFilename: 'filename',
|
|
76
|
-
action: '/upload',
|
|
77
|
-
transformResponse: function transformResponse(response) {
|
|
78
|
-
var targetPath = lodash.get(response, 'results[0].targetPath');
|
|
79
|
-
var filename = lodash.get(response, 'results[0].filename');
|
|
80
|
-
return {
|
|
81
|
-
code: response.code,
|
|
82
|
-
msg: response.msg,
|
|
83
|
-
results: targetPath + (filename ? "?" + globalParams.field.upload.displayFilename + "=" + encodeURIComponent(filename) : '')
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
avatar: {
|
|
88
|
-
transformResponse: function transformResponse(response) {
|
|
89
|
-
return {
|
|
90
|
-
code: response.code,
|
|
91
|
-
results: response.results,
|
|
92
|
-
msg: response.msg
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
|
-
action: '/upload'
|
|
96
|
-
}
|
|
97
|
-
}
|
|
1197
|
+
field: {}
|
|
98
1198
|
};
|
|
99
1199
|
var preset = (function (props) {
|
|
100
1200
|
var defaultProps = {};
|
|
101
|
-
|
|
1201
|
+
merge__default["default"](globalParams, props);
|
|
102
1202
|
Object.keys(globalParams.field).forEach(function (name) {
|
|
103
1203
|
defaultProps[name] = (globalParams.field[name] || {}).defaultProps;
|
|
104
1204
|
});
|
|
@@ -109,7 +1209,7 @@ var preset = (function (props) {
|
|
|
109
1209
|
ReactForm.preset(globalParams.rules);
|
|
110
1210
|
});
|
|
111
1211
|
|
|
112
|
-
var _excluded$
|
|
1212
|
+
var _excluded$4 = ["className", "cache", "enterSubmit", "scrollToError", "scrollProps", "type", "size", "children"];
|
|
113
1213
|
var ScrollToError = reactFormHelper.widget.ScrollToError,
|
|
114
1214
|
EnterSubmit = reactFormHelper.widget.EnterSubmit,
|
|
115
1215
|
FormStore = reactFormHelper.widget.FormStore,
|
|
@@ -122,7 +1222,7 @@ var Form = React.forwardRef(function (originProps, ref) {
|
|
|
122
1222
|
scrollToError = originProps.scrollToError,
|
|
123
1223
|
scrollProps = originProps.scrollProps,
|
|
124
1224
|
children = originProps.children,
|
|
125
|
-
props = _objectWithoutPropertiesLoose(originProps, _excluded$
|
|
1225
|
+
props = _objectWithoutPropertiesLoose(originProps, _excluded$4);
|
|
126
1226
|
var baseClass = 'react-form';
|
|
127
1227
|
var computedClass = baseClass;
|
|
128
1228
|
var _Object$assign = Object.assign({
|
|
@@ -164,709 +1264,103 @@ Form.defaultProps = {
|
|
|
164
1264
|
}
|
|
165
1265
|
};
|
|
166
1266
|
Form.propTypes = {
|
|
167
|
-
className:
|
|
168
|
-
type:
|
|
169
|
-
size:
|
|
170
|
-
enterSubmit:
|
|
171
|
-
scrollToError:
|
|
172
|
-
scrollProps:
|
|
173
|
-
block:
|
|
174
|
-
behavior:
|
|
175
|
-
inline:
|
|
1267
|
+
className: PropTypes.string,
|
|
1268
|
+
type: PropTypes.oneOf(['inline', 'default', 'inner']),
|
|
1269
|
+
size: PropTypes.oneOf(['small', 'middle', 'large']),
|
|
1270
|
+
enterSubmit: PropTypes.bool,
|
|
1271
|
+
scrollToError: PropTypes.bool,
|
|
1272
|
+
scrollProps: PropTypes.shape({
|
|
1273
|
+
block: PropTypes.oneOf(['start', 'center', 'end', 'nearest']),
|
|
1274
|
+
behavior: PropTypes.oneOf(['auto', 'smooth']),
|
|
1275
|
+
inline: PropTypes.oneOf(['start', 'center', 'end', 'nearest'])
|
|
176
1276
|
})
|
|
177
1277
|
};
|
|
178
1278
|
|
|
179
|
-
var RotateIcon = function RotateIcon(props) {
|
|
180
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
181
|
-
width: "1em",
|
|
182
|
-
height: "1em",
|
|
183
|
-
viewBox: "0 0 14 14",
|
|
184
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
185
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
186
|
-
}, props), /*#__PURE__*/React__namespace.createElement("title", null, "\u65CB\u8F6C"), /*#__PURE__*/React__namespace.createElement("g", {
|
|
187
|
-
id: "PC\\u7AEF",
|
|
188
|
-
stroke: "none",
|
|
189
|
-
strokeWidth: 1,
|
|
190
|
-
fill: "none",
|
|
191
|
-
fillRule: "evenodd"
|
|
192
|
-
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
193
|
-
id: "\\u56FE\\u6807",
|
|
194
|
-
transform: "translate(-77.000000, -1567.000000)",
|
|
195
|
-
fill: "#222222",
|
|
196
|
-
fillRule: "nonzero"
|
|
197
|
-
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
198
|
-
id: "\\u65CB\\u8F6C",
|
|
199
|
-
transform: "translate(77.000000, 1567.000000)"
|
|
200
|
-
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
201
|
-
d: "M9.16414904,5.6345426 C9.35110931,5.6345426 9.53041217,5.70881228 9.66261304,5.84101315 C9.79481391,5.97321402 9.86908359,6.15251688 9.86908359,6.33947715 L9.86908359,12.683888 C9.86908359,13.0732126 9.55347364,13.3888226 9.16414904,13.3888226 L0.704934547,13.3888226 C0.315609953,13.3888226 1.8189894e-12,13.0732126 1.8189894e-12,12.683888 L1.8189894e-12,6.33947715 C1.8189894e-12,6.15251688 0.0742696765,5.97321402 0.206470548,5.84101315 C0.33867142,5.70881228 0.517974281,5.6345426 0.704934547,5.6345426 L9.16414904,5.6345426 Z M8.4592145,7.04441168 L1.40986909,7.04441168 L1.40986909,11.9789535 L8.4592145,11.9789535 L8.4592145,7.04441168 Z M7.58258803,0.714885198 C7.63035214,0.738767256 7.66052367,0.787585825 7.66052367,0.840987728 L7.66052367,2.02739256 C11.1625178,2.03011634 14,4.86980822 14,8.37180343 C14,8.62367799 13.8656872,8.85643618 13.6475639,8.98238459 C13.4294405,9.108333 13.1606904,9.108333 12.942567,8.98238459 C12.7244437,8.85643618 12.5900924,8.62367799 12.5901309,8.37180343 C12.5901323,5.64845715 10.3838686,3.43998499 7.66052367,3.43726164 L7.66052367,4.50664733 C7.66052367,4.56004923 7.63035214,4.6088678 7.58258803,4.63274986 C7.53482391,4.65663192 7.47766614,4.65147801 7.43494462,4.61943686 L4.99093655,2.78660706 C4.95543522,2.75998107 4.93454178,2.71819419 4.93454178,2.67381753 C4.93454178,2.62944087 4.95543522,2.58765399 4.99093655,2.561028 L7.43494462,0.728198195 C7.47766614,0.696157053 7.53482391,0.691003139 7.58258803,0.714885198 Z",
|
|
202
|
-
id: "\\u5F62\\u72B6\\u7ED3\\u5408"
|
|
203
|
-
})))));
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
var FullIcon = function FullIcon(props) {
|
|
207
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
208
|
-
width: "1em",
|
|
209
|
-
height: "1em",
|
|
210
|
-
viewBox: "0 0 14 14",
|
|
211
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
212
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
213
|
-
}, props), /*#__PURE__*/React__namespace.createElement("title", null, "\u5145\u6EE1"), /*#__PURE__*/React__namespace.createElement("g", {
|
|
214
|
-
id: "PC\\u7AEF",
|
|
215
|
-
stroke: "none",
|
|
216
|
-
strokeWidth: 1,
|
|
217
|
-
fill: "none",
|
|
218
|
-
fillRule: "evenodd"
|
|
219
|
-
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
220
|
-
id: "\\u56FE\\u6807",
|
|
221
|
-
transform: "translate(-145.000000, -1567.000000)",
|
|
222
|
-
fill: "#222222",
|
|
223
|
-
fillRule: "nonzero"
|
|
224
|
-
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
225
|
-
id: "\\u5145\\u6EE1",
|
|
226
|
-
transform: "translate(145.000000, 1567.000000)"
|
|
227
|
-
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
228
|
-
d: "M12.09375,0 C12.35,0 12.6,0.05 12.8359375,0.15 C13.0640625,0.2453125 13.2671875,0.3828125 13.4421875,0.5578125 C13.6171875,0.7328125 13.7546875,0.9375 13.85,1.1640625 C13.95,1.4 14,1.65 14,1.90625 L14,1.90625 L14,12.09375 C14,12.35 13.95,12.6 13.85,12.8359375 C13.7546875,13.0640625 13.6171875,13.2671875 13.4421875,13.4421875 C13.2671875,13.6171875 13.0625,13.7546875 12.8359375,13.85 C12.6,13.95 12.35,14 12.09375,14 L12.09375,14 L1.90625,14 C1.65,14 1.4,13.95 1.1640625,13.85 C0.9359375,13.7546875 0.7328125,13.6171875 0.5578125,13.4421875 C0.3828125,13.2671875 0.2453125,13.0625 0.15,12.8359375 C0.05,12.6 0,12.35 0,12.09375 L0,12.09375 L0,1.90625 C0,1.65 0.05,1.4 0.15,1.1640625 C0.2453125,0.9359375 0.3828125,0.7328125 0.5578125,0.5578125 C0.7328125,0.3828125 0.9375,0.2453125 1.1640625,0.15 C1.4,0.05 1.65,0 1.90625,0 L1.90625,0 Z M12.09375,1.125 L1.90625,1.125 C1.475,1.125 1.125,1.475 1.125,1.90625 L1.125,1.90625 L1.125,12.09375 C1.125,12.525 1.475,12.875 1.90625,12.875 L1.90625,12.875 L12.09375,12.875 C12.525,12.875 12.875,12.525 12.875,12.09375 L12.875,12.09375 L12.875,1.90625 C12.875,1.475 12.525,1.125 12.09375,1.125 L12.09375,1.125 Z M2.5734375,7.484375 C2.878125,7.490625 3.125,7.740625 3.125,8.046875 L3.125,8.046875 L3.125,10.0640625 L5.1265625,8.0625 C5.3453125,7.84375 5.703125,7.84375 5.921875,8.0625 C6.140625,8.28125 6.140625,8.6390625 5.921875,8.8578125 L5.921875,8.8578125 L3.903125,10.875 L5.909375,10.875 C6.2265625,10.875 6.4890625,11.13125 6.484375,11.4484375 C6.478125,11.7546875 6.228125,12 5.921875,12 L5.921875,12 L2.5734375,12 C2.25625,12 2,11.74375 2,11.4265625 L2,11.4265625 L2,8.0578125 C2,7.740625 2.2578125,7.478125 2.5734375,7.484375 Z M11.4296875,2 C11.7453125,2 12,2.25625 12,2.5703125 L12,2.5703125 L12,5.940625 C12,6.2578125 11.7421875,6.5203125 11.4265625,6.5140625 C11.121875,6.5078125 10.875,6.2578125 10.875,5.9515625 L10.875,5.9515625 L10.875,3.9359375 L8.8734375,5.9375 C8.6546875,6.15625 8.296875,6.15625 8.078125,5.9375 C7.859375,5.71875 7.859375,5.3609375 8.078125,5.1421875 L8.078125,5.1421875 L10.0953125,3.125 L8.0890625,3.125 C7.771875,3.125 7.509375,2.86875 7.515625,2.5515625 C7.521875,2.2453125 7.771875,2 8.078125,2 L8.078125,2 Z",
|
|
229
|
-
id: "\\u5F62\\u72B6\\u7ED3\\u5408"
|
|
230
|
-
})))));
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
var getPopupContainer = function getPopupContainer(triggerNode) {
|
|
234
|
-
var findAntdPopupContainer = function findAntdPopupContainer(el) {
|
|
235
|
-
if (el === document.body || !el.parentElement) {
|
|
236
|
-
return document.body;
|
|
237
|
-
}
|
|
238
|
-
var targetEl = [].slice.call(el.classList, 0).find(function (className) {
|
|
239
|
-
return ['ant-modal-body', 'ant-modal-content', 'ant-popover-content'].indexOf(className) > -1;
|
|
240
|
-
});
|
|
241
|
-
if (targetEl) {
|
|
242
|
-
return el;
|
|
243
|
-
}
|
|
244
|
-
return findAntdPopupContainer(el.parentElement);
|
|
245
|
-
};
|
|
246
|
-
return findAntdPopupContainer(triggerNode);
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
var _excluded$6 = ["close", "file", "editor", "onComplete"];
|
|
250
|
-
var useOnChange$e = reactFormHelper.hooks.useOnChange;
|
|
251
|
-
var avatarParams = globalParams.field.avatar;
|
|
252
|
-
var createAvatarEditor = withLayer__default["default"](function (_ref) {
|
|
253
|
-
var close = _ref.close,
|
|
254
|
-
file = _ref.file,
|
|
255
|
-
editor = _ref.editor,
|
|
256
|
-
onComplete = _ref.onComplete,
|
|
257
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
258
|
-
var editorRef = React.useRef(null);
|
|
259
|
-
var _useState = React.useState(0),
|
|
260
|
-
rotate = _useState[0],
|
|
261
|
-
setRotate = _useState[1];
|
|
262
|
-
var _useState2 = React.useState(function () {
|
|
263
|
-
if (editor.width === editor.height) {
|
|
264
|
-
return 1;
|
|
265
|
-
}
|
|
266
|
-
return 0.35;
|
|
267
|
-
}),
|
|
268
|
-
scale = _useState2[0],
|
|
269
|
-
setScale = _useState2[1];
|
|
270
|
-
antd.App.useApp();
|
|
271
|
-
return /*#__PURE__*/React__default["default"].createElement(antd.Modal, _extends({}, props, {
|
|
272
|
-
className: editor.className,
|
|
273
|
-
centered: true,
|
|
274
|
-
onOk: function onOk() {
|
|
275
|
-
onComplete && onComplete(editorRef.current.getImage().toDataURL());
|
|
276
|
-
close();
|
|
277
|
-
}
|
|
278
|
-
}), editor.tips ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
279
|
-
className: "react-form-avatar-tips"
|
|
280
|
-
}, editor.tips) : null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
281
|
-
style: {
|
|
282
|
-
"width": editor.width,
|
|
283
|
-
"margin": "auto"
|
|
284
|
-
}
|
|
285
|
-
}, /*#__PURE__*/React__default["default"].createElement(AvatarEditor__default["default"], {
|
|
286
|
-
ref: editorRef,
|
|
287
|
-
image: file,
|
|
288
|
-
width: editor.width,
|
|
289
|
-
height: editor.height,
|
|
290
|
-
border: 1,
|
|
291
|
-
borderRadius: editor.borderRadius,
|
|
292
|
-
color: [24, 144, 255, 1] // RGBA
|
|
293
|
-
,
|
|
294
|
-
scale: scale,
|
|
295
|
-
rotate: rotate
|
|
296
|
-
}), /*#__PURE__*/React__default["default"].createElement(antd.Row, {
|
|
297
|
-
gutter: 4,
|
|
298
|
-
align: "middle"
|
|
299
|
-
}, /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
300
|
-
span: 4
|
|
301
|
-
}, /*#__PURE__*/React__default["default"].createElement(antd.Tooltip, {
|
|
302
|
-
title: "\u65CB\u8F6C",
|
|
303
|
-
placement: "bottom",
|
|
304
|
-
getPopupContainer: getPopupContainer
|
|
305
|
-
}, /*#__PURE__*/React__default["default"].createElement(RotateIcon, {
|
|
306
|
-
className: "react-form-avatar-btn",
|
|
307
|
-
onClick: function onClick() {
|
|
308
|
-
setRotate(function (rotate) {
|
|
309
|
-
return (rotate - 90) % 360;
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
}))), /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
313
|
-
span: 4
|
|
314
|
-
}, /*#__PURE__*/React__default["default"].createElement(antd.Tooltip, {
|
|
315
|
-
title: "\u8FD8\u539F",
|
|
316
|
-
placement: "bottom",
|
|
317
|
-
getPopupContainer: getPopupContainer
|
|
318
|
-
}, /*#__PURE__*/React__default["default"].createElement(FullIcon, {
|
|
319
|
-
className: "react-form-avatar-btn",
|
|
320
|
-
onClick: function onClick() {
|
|
321
|
-
setScale(1);
|
|
322
|
-
}
|
|
323
|
-
}))), /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
324
|
-
flex: 1
|
|
325
|
-
}, /*#__PURE__*/React__default["default"].createElement(antd.Slider, {
|
|
326
|
-
className: "react-form-avatar-slider",
|
|
327
|
-
tooltip: {
|
|
328
|
-
placement: "bottom",
|
|
329
|
-
formatter: function formatter() {
|
|
330
|
-
return '大小';
|
|
331
|
-
},
|
|
332
|
-
getPopupContainer: getPopupContainer
|
|
333
|
-
},
|
|
334
|
-
value: scale,
|
|
335
|
-
step: 0.05,
|
|
336
|
-
min: 0.2,
|
|
337
|
-
max: 3,
|
|
338
|
-
onChange: setScale
|
|
339
|
-
})))));
|
|
340
|
-
});
|
|
341
|
-
var _Avatar = function _Avatar(_ref2) {
|
|
342
|
-
var className = _ref2.className,
|
|
343
|
-
imageUrl = _ref2.value,
|
|
344
|
-
propsChange = _ref2.onChange,
|
|
345
|
-
onBeforeUpload = _ref2.beforeUpload,
|
|
346
|
-
transformResponse = _ref2.transformResponse,
|
|
347
|
-
action = _ref2.action,
|
|
348
|
-
imageType = _ref2.imageType,
|
|
349
|
-
size = _ref2.fileSize,
|
|
350
|
-
children = _ref2.children,
|
|
351
|
-
extraRender = _ref2.extraRender,
|
|
352
|
-
onError = _ref2.onError,
|
|
353
|
-
openEditor = _ref2.openEditor,
|
|
354
|
-
editorTips = _ref2.editorTips,
|
|
355
|
-
targetEditor = _ref2.editor,
|
|
356
|
-
previewImg = _ref2.previewImg,
|
|
357
|
-
previewRender = _ref2.previewRender;
|
|
358
|
-
var _useState3 = React.useState(false),
|
|
359
|
-
loading = _useState3[0],
|
|
360
|
-
setLoading = _useState3[1];
|
|
361
|
-
var _useState4 = React.useState(imageUrl),
|
|
362
|
-
showImageUrl = _useState4[0],
|
|
363
|
-
setImageUrl = _useState4[1];
|
|
364
|
-
React.useRef();
|
|
365
|
-
var defaultEditor = {
|
|
366
|
-
open: false,
|
|
367
|
-
width: 250,
|
|
368
|
-
height: 250,
|
|
369
|
-
borderRadius: 1,
|
|
370
|
-
text: "确定",
|
|
371
|
-
cancelText: '取消',
|
|
372
|
-
title: "裁剪图片",
|
|
373
|
-
tips: null
|
|
374
|
-
};
|
|
375
|
-
var editor = lodash.merge({}, defaultEditor, {
|
|
376
|
-
open: openEditor,
|
|
377
|
-
tips: editorTips
|
|
378
|
-
}, targetEditor);
|
|
379
|
-
React.useEffect(function () {
|
|
380
|
-
setImageUrl(imageUrl);
|
|
381
|
-
}, [imageUrl]);
|
|
382
|
-
|
|
383
|
-
/* base64转blob */
|
|
384
|
-
var dataURLtoBlob = function dataURLtoBlob(dataurl) {
|
|
385
|
-
var arr = dataurl.split(",");
|
|
386
|
-
// 注意base64的最后面中括号和引号是不转译的
|
|
387
|
-
var _arr = arr[1].substring(0, arr[1].length - 2);
|
|
388
|
-
var mime = arr[0].match(/:(.*?);/)[1],
|
|
389
|
-
bstr = atob(_arr),
|
|
390
|
-
n = bstr.length,
|
|
391
|
-
u8arr = new Uint8Array(n);
|
|
392
|
-
while (n--) {
|
|
393
|
-
u8arr[n] = bstr.charCodeAt(n);
|
|
394
|
-
}
|
|
395
|
-
return new Blob([u8arr], {
|
|
396
|
-
type: mime
|
|
397
|
-
});
|
|
398
|
-
};
|
|
399
|
-
var uploadButton = /*#__PURE__*/React__default["default"].createElement("div", null, loading ? /*#__PURE__*/React__default["default"].createElement(icons.LoadingOutlined, null) : /*#__PURE__*/React__default["default"].createElement(icons.PlusOutlined, null), children);
|
|
400
|
-
var beforeUpload = function beforeUpload(file) {
|
|
401
|
-
try {
|
|
402
|
-
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
403
|
-
var isJpgOrPng = imageType.indexOf(file.type) > -1;
|
|
404
|
-
if (!isJpgOrPng) {
|
|
405
|
-
onError("\u53EA\u652F\u6301" + imageType.map(function (str) {
|
|
406
|
-
return str.replace("image/", "");
|
|
407
|
-
}).join("/") + "\u683C\u5F0F\u56FE\u7247!", "typeError", {
|
|
408
|
-
type: imageType,
|
|
409
|
-
fileType: file.type
|
|
410
|
-
});
|
|
411
|
-
reject();
|
|
412
|
-
return false;
|
|
413
|
-
}
|
|
414
|
-
var isLt = file.size / 1024 / 1024 < size;
|
|
415
|
-
if (!isLt) {
|
|
416
|
-
onError("\u56FE\u7247\u4E0D\u80FD\u8D85\u8FC7" + size + "MB!", "sizeError", {
|
|
417
|
-
size: size,
|
|
418
|
-
fileSize: file.size
|
|
419
|
-
});
|
|
420
|
-
reject();
|
|
421
|
-
return false;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/*剪切图像*/
|
|
425
|
-
// editor:{open:false,width:250,height:250,borderRadius:0-100,text:'剪切'}
|
|
426
|
-
if (editor.open) {
|
|
427
|
-
createAvatarEditor({
|
|
428
|
-
editor: editor,
|
|
429
|
-
file: file,
|
|
430
|
-
title: editor.title,
|
|
431
|
-
icon: "",
|
|
432
|
-
width: editor.width * 2,
|
|
433
|
-
cancelText: editor.cancelText,
|
|
434
|
-
okText: editor.text,
|
|
435
|
-
onComplete: function onComplete(base64) {
|
|
436
|
-
setImageUrl(base64);
|
|
437
|
-
var blob = dataURLtoBlob(base64);
|
|
438
|
-
var files = new window.File([blob], file.name, {
|
|
439
|
-
type: file.type
|
|
440
|
-
});
|
|
441
|
-
onBeforeUpload && onBeforeUpload(files);
|
|
442
|
-
resolve(files);
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
} else {
|
|
446
|
-
onBeforeUpload && onBeforeUpload(file);
|
|
447
|
-
resolve(file);
|
|
448
|
-
}
|
|
449
|
-
}));
|
|
450
|
-
} catch (e) {
|
|
451
|
-
return Promise.reject(e);
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
var onChange = function onChange(info) {
|
|
455
|
-
if (info.file.status === "uploading") {
|
|
456
|
-
setLoading(true);
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
if (info.file.status === "done") {
|
|
460
|
-
setLoading(false);
|
|
461
|
-
var response = (transformResponse || avatarParams.transformResponse)(info.file.response);
|
|
462
|
-
if (response.code === 200) {
|
|
463
|
-
propsChange(response.results);
|
|
464
|
-
} else {
|
|
465
|
-
onError(response.msg, "xhrError", response);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
var headers = Object.assign({}, avatarParams.headers);
|
|
470
|
-
if (typeof avatarParams.getHeaders === 'function') {
|
|
471
|
-
Object.assign(headers, avatarParams.getHeaders());
|
|
472
|
-
}
|
|
473
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(antd.Upload, _extends({}, lodash.omit(avatarParams, ['action', 'transformResponse', 'headers', 'getHeaders']), {
|
|
474
|
-
headers: headers,
|
|
475
|
-
className: classnames__default["default"](className, "react-form-avatar"),
|
|
476
|
-
listType: "picture-card",
|
|
477
|
-
showUploadList: false,
|
|
478
|
-
action: action || avatarParams.action,
|
|
479
|
-
beforeUpload: beforeUpload,
|
|
480
|
-
onChange: onChange
|
|
481
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
482
|
-
className: "react-form-avatar-inner"
|
|
483
|
-
}, previewImg && showImageUrl ? previewRender ? previewRender(showImageUrl) : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
484
|
-
className: "preview"
|
|
485
|
-
}, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
486
|
-
src: showImageUrl,
|
|
487
|
-
alt: "avatar"
|
|
488
|
-
})) : uploadButton, extraRender ? extraRender(showImageUrl) : '')));
|
|
489
|
-
};
|
|
490
|
-
_Avatar.defaultProps = {
|
|
491
|
-
imageType: ["image/jpeg", "image/png"],
|
|
492
|
-
fileSize: 2,
|
|
493
|
-
// 单位MB
|
|
494
|
-
children: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
495
|
-
className: "ant-upload-text"
|
|
496
|
-
}, "\u70B9\u51FB\u4E0A\u4F20"),
|
|
497
|
-
extraRender: null,
|
|
498
|
-
onError: function onError(info) {
|
|
499
|
-
return antd.message.error(info);
|
|
500
|
-
},
|
|
501
|
-
previewImg: true,
|
|
502
|
-
previewRender: null,
|
|
503
|
-
openEditor: false
|
|
504
|
-
};
|
|
505
|
-
var AvatarInput = function AvatarInput(props) {
|
|
506
|
-
var render = useOnChange$e(props);
|
|
507
|
-
return render(_Avatar);
|
|
508
|
-
};
|
|
509
|
-
AvatarInput.defaultProps = {
|
|
510
|
-
fieldName: 'avatar'
|
|
511
|
-
};
|
|
512
|
-
AvatarInput.field = _Avatar;
|
|
513
|
-
|
|
514
|
-
var _excluded$5 = ["action", "value", "onChange", "drag", "children", "displayFilename", "accept", "fileSize", "onError", "onUploadComplete", "onBeforeUpload", "maxLength", "transformResponse"];
|
|
515
|
-
var useOnChange$d = reactFormHelper.hooks.useOnChange;
|
|
516
|
-
var Dragger = antd.Upload.Dragger;
|
|
517
|
-
var uploadParams = globalParams.field.upload;
|
|
518
|
-
var decodeURIComponentSafe = function decodeURIComponentSafe(str) {
|
|
519
|
-
try {
|
|
520
|
-
return decodeURIComponent(str);
|
|
521
|
-
} catch (e) {
|
|
522
|
-
return str;
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
var computedFilename = function computedFilename(path, displayFilename) {
|
|
526
|
-
if (displayFilename === void 0) {
|
|
527
|
-
displayFilename = 'filename';
|
|
528
|
-
}
|
|
529
|
-
var strArray = path.split('?');
|
|
530
|
-
if (strArray[1]) {
|
|
531
|
-
var query = {};
|
|
532
|
-
strArray[1].split('&').forEach(function (str) {
|
|
533
|
-
var _str$split = str.split('='),
|
|
534
|
-
key = _str$split[0],
|
|
535
|
-
value = _str$split[1];
|
|
536
|
-
query[key] = value;
|
|
537
|
-
});
|
|
538
|
-
if (query[displayFilename]) {
|
|
539
|
-
return decodeURIComponentSafe(query[displayFilename]);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
return path;
|
|
543
|
-
};
|
|
544
|
-
var valueToList = function valueToList(value, displayFilename) {
|
|
545
|
-
if (!value) {
|
|
546
|
-
return [];
|
|
547
|
-
}
|
|
548
|
-
return value.map(function (item) {
|
|
549
|
-
return {
|
|
550
|
-
uid: lodash.uniqueId(),
|
|
551
|
-
name: computedFilename(item.substr(item.lastIndexOf('/') + 1), displayFilename),
|
|
552
|
-
status: 'done',
|
|
553
|
-
response: {
|
|
554
|
-
code: 200,
|
|
555
|
-
results: item
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
});
|
|
559
|
-
};
|
|
560
|
-
var listToValue = function listToValue(value) {
|
|
561
|
-
return (value || []).slice(0).filter(function (_ref) {
|
|
562
|
-
var status = _ref.status;
|
|
563
|
-
return status === 'done';
|
|
564
|
-
}).map(function (_ref2) {
|
|
565
|
-
var response = _ref2.response;
|
|
566
|
-
return response.results;
|
|
567
|
-
});
|
|
568
|
-
};
|
|
569
|
-
var _Upload = function _Upload(_ref3) {
|
|
570
|
-
var action = _ref3.action,
|
|
571
|
-
value = _ref3.value,
|
|
572
|
-
onChange = _ref3.onChange,
|
|
573
|
-
drag = _ref3.drag,
|
|
574
|
-
children = _ref3.children,
|
|
575
|
-
displayFilename = _ref3.displayFilename,
|
|
576
|
-
accept = _ref3.accept,
|
|
577
|
-
size = _ref3.fileSize,
|
|
578
|
-
onError = _ref3.onError,
|
|
579
|
-
onUploadComplete = _ref3.onUploadComplete,
|
|
580
|
-
onBeforeUpload = _ref3.onBeforeUpload,
|
|
581
|
-
maxLength = _ref3.maxLength,
|
|
582
|
-
transformResponse = _ref3.transformResponse,
|
|
583
|
-
props = _objectWithoutPropertiesLoose(_ref3, _excluded$5);
|
|
584
|
-
displayFilename = displayFilename || uploadParams.displayFilename;
|
|
585
|
-
value = value || [];
|
|
586
|
-
var _useState = React.useState([]),
|
|
587
|
-
list = _useState[0],
|
|
588
|
-
setList = _useState[1];
|
|
589
|
-
var valueList = React.useMemo(function () {
|
|
590
|
-
return valueToList(value.filter(function (url) {
|
|
591
|
-
return !list.find(function (file) {
|
|
592
|
-
return decodeURIComponentSafe(lodash.get(file, 'response.results', '')) === decodeURIComponentSafe(url);
|
|
593
|
-
});
|
|
594
|
-
}), displayFilename).concat(list);
|
|
595
|
-
}, [list, value, displayFilename]);
|
|
596
|
-
var changeHandler = function changeHandler(info) {
|
|
597
|
-
var _info$fileList;
|
|
598
|
-
if (['uploading', 'done', 'error', 'removed'].indexOf(info.file.status) === -1) {
|
|
599
|
-
return;
|
|
600
|
-
}
|
|
601
|
-
if (((_info$fileList = info.fileList) == null ? void 0 : _info$fileList.length) > maxLength) {
|
|
602
|
-
var _info$fileList2;
|
|
603
|
-
if (JSON.stringify(info.file) === JSON.stringify(info.fileList[((_info$fileList2 = info.fileList) == null ? void 0 : _info$fileList2.length) - 1])) {
|
|
604
|
-
onError("\u4E0A\u4F20\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7\u6700\u5927\u5141\u8BB8\u6570\u91CF" + maxLength, 'lengthError', maxLength);
|
|
605
|
-
}
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
if (info.file.status === 'done' && info.fileList.find(function (_ref4) {
|
|
609
|
-
var uid = _ref4.uid;
|
|
610
|
-
return uid === info.file.uid;
|
|
611
|
-
})) {
|
|
612
|
-
info.file.response = (transformResponse || uploadParams.transformResponse)(info.file.response);
|
|
613
|
-
if (info.file.response.code === 200) {
|
|
614
|
-
info.file.name = computedFilename(info.file.response.results.substr(info.file.response.results.lastIndexOf('/') + 1), displayFilename);
|
|
615
|
-
onUploadComplete(info);
|
|
616
|
-
} else {
|
|
617
|
-
info.file.status = 'error';
|
|
618
|
-
onError(info.file.response.msg, 'xhrError', info.file.response);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
var _groupBy = lodash.groupBy(info.fileList, function (file) {
|
|
622
|
-
return file.status === 'done' ? 'done' : 'uploading';
|
|
623
|
-
}),
|
|
624
|
-
done = _groupBy.done;
|
|
625
|
-
if (['done', 'removed'].indexOf(info.file.status) > -1) {
|
|
626
|
-
onChange(listToValue(done));
|
|
627
|
-
}
|
|
628
|
-
setList(function (list) {
|
|
629
|
-
var newList = list.slice(0);
|
|
630
|
-
var index = list.findIndex(function (_ref5) {
|
|
631
|
-
var uid = _ref5.uid;
|
|
632
|
-
return uid === info.file.uid;
|
|
633
|
-
});
|
|
634
|
-
if (info.file.status === 'removed') {
|
|
635
|
-
index > -1 && newList.splice(index, 1);
|
|
636
|
-
return newList;
|
|
637
|
-
}
|
|
638
|
-
if (index === -1) {
|
|
639
|
-
newList.push(info.file);
|
|
640
|
-
return newList;
|
|
641
|
-
}
|
|
642
|
-
newList.splice(index, 1, info.file);
|
|
643
|
-
return newList;
|
|
644
|
-
});
|
|
645
|
-
};
|
|
646
|
-
var beforeUploadHandler = function beforeUploadHandler(file) {
|
|
647
|
-
var isLt = file.size / 1024 / 1024 < size;
|
|
648
|
-
if (!isLt) {
|
|
649
|
-
onError("\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7" + size + "MB!", 'sizeError', {
|
|
650
|
-
size: size,
|
|
651
|
-
fileSize: file.size
|
|
652
|
-
});
|
|
653
|
-
return false;
|
|
654
|
-
}
|
|
655
|
-
if (maxLength === 1) {
|
|
656
|
-
onChange([]);
|
|
657
|
-
setList([]);
|
|
658
|
-
}
|
|
659
|
-
return onBeforeUpload && onBeforeUpload(file);
|
|
660
|
-
};
|
|
661
|
-
var headers = Object.assign({}, uploadParams.headers);
|
|
662
|
-
if (typeof uploadParams.getHeaders === 'function') {
|
|
663
|
-
Object.assign(headers, uploadParams.getHeaders());
|
|
664
|
-
}
|
|
665
|
-
var UploadComponent = drag ? Dragger : antd.Upload;
|
|
666
|
-
return /*#__PURE__*/React__default["default"].createElement(UploadComponent, _extends({}, lodash.omit(uploadParams, ['action', 'transformResponse']), props, {
|
|
667
|
-
headers: headers,
|
|
668
|
-
action: action || uploadParams.action,
|
|
669
|
-
fileList: valueList,
|
|
670
|
-
accept: accept.join(','),
|
|
671
|
-
onChange: changeHandler,
|
|
672
|
-
beforeUpload: beforeUploadHandler
|
|
673
|
-
}), typeof children === 'function' ? children({
|
|
674
|
-
size: props.size
|
|
675
|
-
}) : children);
|
|
676
|
-
};
|
|
677
|
-
_Upload.defaultProps = {
|
|
678
|
-
value: [],
|
|
679
|
-
accept: [],
|
|
680
|
-
fileSize: 2,
|
|
681
|
-
maxLength: 1,
|
|
682
|
-
children: function children(_ref6) {
|
|
683
|
-
var size = _ref6.size;
|
|
684
|
-
return /*#__PURE__*/React__default["default"].createElement(antd.Button, {
|
|
685
|
-
size: size
|
|
686
|
-
}, /*#__PURE__*/React__default["default"].createElement(icons.UploadOutlined, null), "\u70B9\u51FB\u4E0A\u4F20");
|
|
687
|
-
},
|
|
688
|
-
onError: function onError(info) {
|
|
689
|
-
return antd.message.error(info);
|
|
690
|
-
},
|
|
691
|
-
onUploadComplete: function onUploadComplete() {}
|
|
692
|
-
};
|
|
693
|
-
var UploadInput = function UploadInput(props) {
|
|
694
|
-
var render = useOnChange$d(props);
|
|
695
|
-
return render(_Upload);
|
|
696
|
-
};
|
|
697
|
-
UploadInput.defaultProps = {
|
|
698
|
-
fieldName: 'upload'
|
|
699
|
-
};
|
|
700
|
-
UploadInput.Field = AvatarInput.Field = _Upload;
|
|
701
|
-
|
|
702
|
-
var _excluded$4 = ["data", "setData", "send", "loadMore", "isComplete", "refresh", "reload", "fetchEmitter", "isLoading", "children", "onLoaded", "fetchProps", "requestParams"];
|
|
703
|
-
var useOnChange$c = reactFormHelper.hooks.useOnChange;
|
|
704
|
-
var withFetch = function withFetch(WrappedComponent) {
|
|
705
|
-
var FieldInner = reactFetch.withFetch(function (_ref) {
|
|
706
|
-
var data = _ref.data,
|
|
707
|
-
setData = _ref.setData,
|
|
708
|
-
send = _ref.send,
|
|
709
|
-
loadMore = _ref.loadMore,
|
|
710
|
-
isComplete = _ref.isComplete,
|
|
711
|
-
refresh = _ref.refresh,
|
|
712
|
-
reload = _ref.reload,
|
|
713
|
-
fetchEmitter = _ref.fetchEmitter,
|
|
714
|
-
isLoading = _ref.isLoading,
|
|
715
|
-
children = _ref.children,
|
|
716
|
-
onLoaded = _ref.onLoaded,
|
|
717
|
-
fetchProps = _ref.fetchProps,
|
|
718
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
719
|
-
var refreshRef = React.useRef(refresh);
|
|
720
|
-
refreshRef.current = refresh;
|
|
721
|
-
var reloadRef = React.useRef(reload);
|
|
722
|
-
reloadRef.current = reload;
|
|
723
|
-
var setDataRef = React.useRef(setData);
|
|
724
|
-
setDataRef.current = setData;
|
|
725
|
-
var dataRef = React.useRef(data);
|
|
726
|
-
React.useEffect(function () {
|
|
727
|
-
var token1 = fetchEmitter.addListener('select-fetch-refresh', function () {
|
|
728
|
-
return refreshRef.current();
|
|
729
|
-
});
|
|
730
|
-
var token2 = fetchEmitter.addListener('select-fetch-reload', function () {
|
|
731
|
-
return reloadRef.current();
|
|
732
|
-
});
|
|
733
|
-
var token3 = fetchEmitter.addListener('select-fetch-set-data', function () {
|
|
734
|
-
return setDataRef.current();
|
|
735
|
-
});
|
|
736
|
-
return function () {
|
|
737
|
-
token1 && token1.remove();
|
|
738
|
-
token2 && token2.remove();
|
|
739
|
-
token3 && token3.remove();
|
|
740
|
-
};
|
|
741
|
-
}, [fetchEmitter]);
|
|
742
|
-
React.useEffect(function () {
|
|
743
|
-
onLoaded && onLoaded(dataRef.current);
|
|
744
|
-
}, []);
|
|
745
|
-
return /*#__PURE__*/React__default["default"].createElement(WrappedComponent, _extends({}, props, children({
|
|
746
|
-
data: data,
|
|
747
|
-
fetchProps: fetchProps,
|
|
748
|
-
loadMore: loadMore,
|
|
749
|
-
send: send,
|
|
750
|
-
refresh: refresh,
|
|
751
|
-
reload: reload,
|
|
752
|
-
isLoading: isLoading,
|
|
753
|
-
isComplete: isComplete,
|
|
754
|
-
setData: setData
|
|
755
|
-
})));
|
|
756
|
-
});
|
|
757
|
-
var useFetchEmitter = function useFetchEmitter(ref) {
|
|
758
|
-
var emitter = useEvent__default["default"]();
|
|
759
|
-
React.useImperativeHandle(ref, function () {
|
|
760
|
-
return {
|
|
761
|
-
refresh: function refresh() {
|
|
762
|
-
return emitter.emit('select-fetch-refresh');
|
|
763
|
-
},
|
|
764
|
-
reload: function reload() {
|
|
765
|
-
return emitter.emit('select-fetch-reload');
|
|
766
|
-
},
|
|
767
|
-
setData: function setData(data) {
|
|
768
|
-
return emitter.emit('select-fetch-set-data', data);
|
|
769
|
-
}
|
|
770
|
-
};
|
|
771
|
-
}, [emitter]);
|
|
772
|
-
return emitter;
|
|
773
|
-
};
|
|
774
|
-
var Fetch = React.forwardRef(function (props, ref) {
|
|
775
|
-
var emitter = useFetchEmitter(ref);
|
|
776
|
-
var render = useOnChange$c(Object.assign({
|
|
777
|
-
placeholder: "\u8BF7\u9009\u62E9" + props.label
|
|
778
|
-
}, props, {
|
|
779
|
-
fetchEmitter: emitter
|
|
780
|
-
}));
|
|
781
|
-
return render(FieldInner);
|
|
782
|
-
});
|
|
783
|
-
Fetch.field = React.forwardRef(function (props, ref) {
|
|
784
|
-
var emitter = useFetchEmitter(ref);
|
|
785
|
-
return /*#__PURE__*/React__default["default"].createElement(FieldInner, _extends({}, props, {
|
|
786
|
-
fetchEmitter: emitter
|
|
787
|
-
}));
|
|
788
|
-
});
|
|
789
|
-
return Fetch;
|
|
790
|
-
};
|
|
791
|
-
|
|
792
1279
|
var useOnChange$b = reactFormHelper.hooks.useOnChange;
|
|
793
1280
|
var _TreeSelect = function _TreeSelect(props) {
|
|
1281
|
+
props = Object.assign({}, {
|
|
1282
|
+
fieldName: 'treeSelect'
|
|
1283
|
+
}, props);
|
|
794
1284
|
var render = useOnChange$b(Object.assign({
|
|
795
1285
|
placeholder: "\u8BF7\u9009\u62E9" + (props.label || '')
|
|
796
1286
|
}, props));
|
|
797
1287
|
return render(antd.TreeSelect);
|
|
798
1288
|
};
|
|
799
|
-
_TreeSelect.
|
|
800
|
-
_TreeSelect.defaultProps = _TreeSelect.Fetch.defaultProps = {
|
|
801
|
-
fieldName: 'treeSelect'
|
|
802
|
-
};
|
|
1289
|
+
_TreeSelect.Field = antd.TreeSelect;
|
|
803
1290
|
_TreeSelect.TreeNode = antd.TreeSelect.TreeNode;
|
|
804
1291
|
|
|
805
1292
|
var useOnChange$a = reactFormHelper.hooks.useOnChange;
|
|
806
1293
|
var RangePicker$1 = antd.TimePicker.RangePicker;
|
|
807
1294
|
var _TimePicker = function _TimePicker(props) {
|
|
1295
|
+
props = Object.assign({}, {
|
|
1296
|
+
fieldName: 'timePicker'
|
|
1297
|
+
}, props);
|
|
808
1298
|
var render = useOnChange$a(Object.assign({
|
|
809
1299
|
placeholder: "\u8BF7\u9009\u62E9" + (props.label || '')
|
|
810
1300
|
}, props));
|
|
811
1301
|
return render(antd.TimePicker);
|
|
812
1302
|
};
|
|
813
|
-
_TimePicker.
|
|
814
|
-
fieldName: 'timePicker'
|
|
815
|
-
};
|
|
1303
|
+
_TimePicker.Field = antd.TimePicker;
|
|
816
1304
|
var _RangePicker$1 = function _RangePicker(props) {
|
|
1305
|
+
props = Object.assign({}, {
|
|
1306
|
+
fieldName: 'rangeTimePicker'
|
|
1307
|
+
}, props);
|
|
817
1308
|
var render = useOnChange$a(Object.assign({
|
|
818
1309
|
placeholder: "\u8BF7\u9009\u62E9" + (props.label || '')
|
|
819
1310
|
}, props));
|
|
820
1311
|
return render(RangePicker$1);
|
|
821
1312
|
};
|
|
822
|
-
_RangePicker$1.
|
|
823
|
-
fieldName: 'rangeTimePicker'
|
|
824
|
-
};
|
|
1313
|
+
_RangePicker$1.Field = RangePicker$1;
|
|
825
1314
|
_TimePicker.RangePicker = _RangePicker$1;
|
|
826
1315
|
|
|
827
1316
|
var useDecorator$2 = reactFormHelper.hooks.useDecorator;
|
|
828
1317
|
var TextArea = function TextArea(props) {
|
|
1318
|
+
props = Object.assign({}, {
|
|
1319
|
+
fieldName: 'textArea'
|
|
1320
|
+
}, props);
|
|
829
1321
|
var render = useDecorator$2(Object.assign({
|
|
830
1322
|
placeholder: "\u8BF7\u8F93\u5165" + props.label
|
|
831
1323
|
}, props));
|
|
832
1324
|
return render(antd.Input.TextArea);
|
|
833
1325
|
};
|
|
834
|
-
TextArea.
|
|
835
|
-
fieldName: 'textArea'
|
|
836
|
-
};
|
|
1326
|
+
TextArea.Field = antd.Input.TextArea;
|
|
837
1327
|
|
|
838
1328
|
var useOnChange$9 = reactFormHelper.hooks.useOnChange,
|
|
839
1329
|
useCheckedToValue$1 = reactFormHelper.hooks.useCheckedToValue;
|
|
840
1330
|
var withChecked$1 = reactFormHelper.hoc.withChecked;
|
|
841
1331
|
var WithSwitch = withChecked$1(antd.Switch);
|
|
842
1332
|
var Switch = function Switch(props) {
|
|
1333
|
+
props = Object.assign({}, {
|
|
1334
|
+
fieldName: 'switch'
|
|
1335
|
+
}, props);
|
|
843
1336
|
var checkedProps = useCheckedToValue$1(props);
|
|
844
1337
|
var render = useOnChange$9(checkedProps);
|
|
845
1338
|
return render(WithSwitch);
|
|
846
1339
|
};
|
|
847
|
-
Switch.
|
|
848
|
-
fieldName: 'switch'
|
|
849
|
-
};
|
|
1340
|
+
Switch.Field = antd.Switch;
|
|
850
1341
|
|
|
851
1342
|
var useOnChange$8 = reactFormHelper.hooks.useOnChange;
|
|
852
1343
|
var _Select = function _Select(props) {
|
|
1344
|
+
props = Object.assign({}, {
|
|
1345
|
+
fieldName: 'select'
|
|
1346
|
+
}, props);
|
|
853
1347
|
var render = useOnChange$8(Object.assign({
|
|
854
1348
|
placeholder: "\u8BF7\u9009\u62E9" + (props.label || '')
|
|
855
1349
|
}, props));
|
|
856
1350
|
return render(antd.Select);
|
|
857
1351
|
};
|
|
858
|
-
_Select.
|
|
1352
|
+
_Select.Field = antd.Select;
|
|
859
1353
|
_Select.Option = antd.Select.Option;
|
|
860
1354
|
_Select.OptGroup = antd.Select.OptGroup;
|
|
861
|
-
_Select.defaultProps = _Select.Fetch.defaultProps = {
|
|
862
|
-
fieldName: 'select'
|
|
863
|
-
};
|
|
864
1355
|
|
|
865
1356
|
var _excluded$3 = ["onChange"];
|
|
866
1357
|
var useOnChange$7 = reactFormHelper.hooks.useOnChange;
|
|
867
1358
|
var RadioGroup = function RadioGroup(_ref) {
|
|
868
1359
|
var onChange = _ref.onChange,
|
|
869
1360
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
1361
|
+
props = Object.assign({}, {
|
|
1362
|
+
fieldName: 'radioGroup'
|
|
1363
|
+
}, props);
|
|
870
1364
|
var handler = React.useCallback(function (e) {
|
|
871
1365
|
onChange && onChange(e.target.value);
|
|
872
1366
|
}, [onChange]);
|
|
@@ -878,44 +1372,45 @@ var _RadioGroup = function _RadioGroup(props) {
|
|
|
878
1372
|
var render = useOnChange$7(props);
|
|
879
1373
|
return render(RadioGroup);
|
|
880
1374
|
};
|
|
881
|
-
_RadioGroup.
|
|
882
|
-
fieldName: 'radioGroup'
|
|
883
|
-
};
|
|
1375
|
+
_RadioGroup.Field = RadioGroup;
|
|
884
1376
|
_RadioGroup.Radio = antd.Radio;
|
|
885
1377
|
|
|
886
1378
|
var useDecorator$1 = reactFormHelper.hooks.useDecorator;
|
|
887
1379
|
var InputNumberField = function InputNumberField(props) {
|
|
1380
|
+
props = Object.assign({}, {
|
|
1381
|
+
fieldName: 'inputNumber',
|
|
1382
|
+
autoComplete: 'off'
|
|
1383
|
+
}, props);
|
|
888
1384
|
var render = useDecorator$1(Object.assign({
|
|
889
1385
|
placeholder: "\u8BF7\u8F93\u5165" + props.label
|
|
890
1386
|
}, props));
|
|
891
1387
|
return render(antd.InputNumber);
|
|
892
1388
|
};
|
|
893
|
-
InputNumberField.
|
|
894
|
-
fieldName: 'inputNumber',
|
|
895
|
-
autoComplete: 'off'
|
|
896
|
-
};
|
|
1389
|
+
InputNumberField.Field = antd.InputNumber;
|
|
897
1390
|
|
|
898
1391
|
var useDecorator = reactFormHelper.hooks.useDecorator;
|
|
899
1392
|
var InputField = function InputField(props) {
|
|
1393
|
+
props = Object.assign({}, {
|
|
1394
|
+
fieldName: 'input',
|
|
1395
|
+
autoComplete: 'off'
|
|
1396
|
+
}, props);
|
|
900
1397
|
var render = useDecorator(Object.assign({
|
|
901
1398
|
placeholder: "\u8BF7\u8F93\u5165" + props.label
|
|
902
1399
|
}, props));
|
|
903
1400
|
return render(antd.Input);
|
|
904
1401
|
};
|
|
1402
|
+
InputField.Field = antd.Input;
|
|
905
1403
|
InputField.Password = function (props) {
|
|
1404
|
+
props = Object.assign({}, {
|
|
1405
|
+
fieldName: 'password',
|
|
1406
|
+
autoComplete: 'off'
|
|
1407
|
+
}, props);
|
|
906
1408
|
var render = useDecorator(Object.assign({
|
|
907
1409
|
placeholder: "\u8BF7\u8F93\u5165" + props.label
|
|
908
1410
|
}, props));
|
|
909
1411
|
return render(antd.Input.Password);
|
|
910
1412
|
};
|
|
911
|
-
InputField.
|
|
912
|
-
fieldName: 'input',
|
|
913
|
-
autoComplete: 'off'
|
|
914
|
-
};
|
|
915
|
-
InputField.Password.defaultProps = {
|
|
916
|
-
fieldName: 'password',
|
|
917
|
-
autoComplete: 'off'
|
|
918
|
-
};
|
|
1413
|
+
InputField.Password.Field = antd.Input.Password;
|
|
919
1414
|
|
|
920
1415
|
var _excluded$2 = ["soFarText", "startProps", "endProps"];
|
|
921
1416
|
var useOnChange$6 = reactFormHelper.hooks.useOnChange;
|
|
@@ -1005,54 +1500,58 @@ var PickerToday = function PickerToday(_ref) {
|
|
|
1005
1500
|
}))));
|
|
1006
1501
|
};
|
|
1007
1502
|
var RangePickerToday = function RangePickerToday(props) {
|
|
1503
|
+
props = Object.assign({}, {
|
|
1504
|
+
fieldName: 'rangePickerToday'
|
|
1505
|
+
}, props);
|
|
1008
1506
|
var render = useOnChange$6(props);
|
|
1009
1507
|
return render(PickerToday);
|
|
1010
1508
|
};
|
|
1011
|
-
RangePickerToday.
|
|
1012
|
-
fieldName: 'rangePickerToday'
|
|
1013
|
-
};
|
|
1014
|
-
RangePickerToday.field = PickerToday;
|
|
1509
|
+
RangePickerToday.Field = PickerToday;
|
|
1015
1510
|
|
|
1016
1511
|
var useOnChange$5 = reactFormHelper.hooks.useOnChange;
|
|
1017
1512
|
var MonthPicker = antd.DatePicker.MonthPicker,
|
|
1018
1513
|
RangePicker = antd.DatePicker.RangePicker,
|
|
1019
1514
|
WeekPicker = antd.DatePicker.WeekPicker;
|
|
1020
1515
|
var _DatePicker = function _DatePicker(props) {
|
|
1516
|
+
props = Object.assign({}, {
|
|
1517
|
+
fieldName: 'datePicker'
|
|
1518
|
+
}, props);
|
|
1021
1519
|
var render = useOnChange$5(Object.assign({
|
|
1022
1520
|
placeholder: "\u8BF7\u9009\u62E9" + (props.label || '')
|
|
1023
1521
|
}, props));
|
|
1024
1522
|
return render(antd.DatePicker);
|
|
1025
1523
|
};
|
|
1026
|
-
_DatePicker.
|
|
1027
|
-
fieldName: 'datePicker'
|
|
1028
|
-
};
|
|
1524
|
+
_DatePicker.Field = antd.DatePicker;
|
|
1029
1525
|
var _MonthPicker = function _MonthPicker(props) {
|
|
1526
|
+
props = Object.assign({}, {
|
|
1527
|
+
fieldName: 'monthDatePicker'
|
|
1528
|
+
}, props);
|
|
1030
1529
|
var render = useOnChange$5(Object.assign({
|
|
1031
1530
|
placeholder: ['开始时间', '结束时间']
|
|
1032
1531
|
}, props));
|
|
1033
1532
|
return render(MonthPicker);
|
|
1034
1533
|
};
|
|
1035
|
-
_MonthPicker.
|
|
1036
|
-
fieldName: 'monthDatePicker'
|
|
1037
|
-
};
|
|
1534
|
+
_MonthPicker.Field = MonthPicker;
|
|
1038
1535
|
var _RangePicker = function _RangePicker(props) {
|
|
1536
|
+
props = Object.assign({}, {
|
|
1537
|
+
fieldName: 'rangeDatePicker'
|
|
1538
|
+
}, props);
|
|
1039
1539
|
var render = useOnChange$5(Object.assign({
|
|
1040
1540
|
placeholder: ['开始时间', '结束时间']
|
|
1041
1541
|
}, props));
|
|
1042
1542
|
return render(RangePicker);
|
|
1043
1543
|
};
|
|
1044
|
-
_RangePicker.
|
|
1045
|
-
fieldName: 'rangeDatePicker'
|
|
1046
|
-
};
|
|
1544
|
+
_RangePicker.Field = RangePicker;
|
|
1047
1545
|
var _WeekPicker = function _WeekPicker(props) {
|
|
1546
|
+
props = Object.assign({}, {
|
|
1547
|
+
fieldName: 'weekDatePicker'
|
|
1548
|
+
}, props);
|
|
1048
1549
|
var render = useOnChange$5(Object.assign({
|
|
1049
1550
|
placeholder: ['开始时间', '结束时间']
|
|
1050
1551
|
}, props));
|
|
1051
1552
|
return render(WeekPicker);
|
|
1052
1553
|
};
|
|
1053
|
-
_WeekPicker.
|
|
1054
|
-
fieldName: 'weekDatePicker'
|
|
1055
|
-
};
|
|
1554
|
+
_WeekPicker.Field = WeekPicker;
|
|
1056
1555
|
_DatePicker.MonthPicker = _MonthPicker;
|
|
1057
1556
|
_DatePicker.RangePicker = _RangePicker;
|
|
1058
1557
|
_DatePicker.WeekPicker = _WeekPicker;
|
|
@@ -1060,19 +1559,23 @@ _DatePicker.WeekPicker = _WeekPicker;
|
|
|
1060
1559
|
var useOnChange$4 = reactFormHelper.hooks.useOnChange;
|
|
1061
1560
|
var _CheckboxGroup = antd.Checkbox.Group;
|
|
1062
1561
|
var CheckboxGroup = function CheckboxGroup(props) {
|
|
1562
|
+
props = Object.assign({}, {
|
|
1563
|
+
fieldName: 'checkboxGroup'
|
|
1564
|
+
}, props);
|
|
1063
1565
|
var render = useOnChange$4(props);
|
|
1064
1566
|
return render(_CheckboxGroup);
|
|
1065
1567
|
};
|
|
1066
1568
|
CheckboxGroup.Checkbox = antd.Checkbox;
|
|
1067
|
-
CheckboxGroup.
|
|
1068
|
-
fieldName: 'checkboxGroup'
|
|
1069
|
-
};
|
|
1569
|
+
CheckboxGroup.Field = _CheckboxGroup;
|
|
1070
1570
|
|
|
1071
1571
|
var useOnChange$3 = reactFormHelper.hooks.useOnChange,
|
|
1072
1572
|
useCheckedToValue = reactFormHelper.hooks.useCheckedToValue;
|
|
1073
1573
|
var withChecked = reactFormHelper.hoc.withChecked;
|
|
1074
1574
|
var WithCheckbox = withChecked(antd.Checkbox);
|
|
1075
1575
|
var Checkbox = function Checkbox(props) {
|
|
1576
|
+
props = Object.assign({}, {
|
|
1577
|
+
fieldName: 'checkbox'
|
|
1578
|
+
}, props);
|
|
1076
1579
|
var checkedProps = useCheckedToValue(Object.assign({}, props, {
|
|
1077
1580
|
onChange: function onChange(e) {
|
|
1078
1581
|
e.target.type = 'checkbox';
|
|
@@ -1082,36 +1585,37 @@ var Checkbox = function Checkbox(props) {
|
|
|
1082
1585
|
var render = useOnChange$3(checkedProps);
|
|
1083
1586
|
return render(WithCheckbox);
|
|
1084
1587
|
};
|
|
1085
|
-
Checkbox.
|
|
1086
|
-
fieldName: 'checkbox'
|
|
1087
|
-
};
|
|
1588
|
+
Checkbox.Field = antd.Checkbox;
|
|
1088
1589
|
|
|
1089
1590
|
var useOnChange$2 = reactFormHelper.hooks.useOnChange;
|
|
1090
1591
|
var Cascader = function Cascader(props) {
|
|
1592
|
+
props = Object.assign({}, {
|
|
1593
|
+
fieldName: 'cascader'
|
|
1594
|
+
}, props);
|
|
1091
1595
|
var render = useOnChange$2(props);
|
|
1092
1596
|
return render(antd.Cascader);
|
|
1093
1597
|
};
|
|
1094
|
-
Cascader.
|
|
1095
|
-
fieldName: 'cascader'
|
|
1096
|
-
};
|
|
1598
|
+
Cascader.Field = antd.Cascader;
|
|
1097
1599
|
|
|
1098
1600
|
var useOnChange$1 = reactFormHelper.hooks.useOnChange;
|
|
1099
1601
|
var Rate = function Rate(props) {
|
|
1602
|
+
props = Object.assign({}, {
|
|
1603
|
+
fieldName: 'rate'
|
|
1604
|
+
}, props);
|
|
1100
1605
|
var render = useOnChange$1(Object.assign({}, props));
|
|
1101
1606
|
return render(antd.Rate);
|
|
1102
1607
|
};
|
|
1103
|
-
Rate.
|
|
1104
|
-
fieldName: 'rate'
|
|
1105
|
-
};
|
|
1608
|
+
Rate.Field = antd.Rate;
|
|
1106
1609
|
|
|
1107
1610
|
var useOnChange = reactFormHelper.hooks.useOnChange;
|
|
1108
1611
|
var Slider = function Slider(props) {
|
|
1612
|
+
props = Object.assign({}, {
|
|
1613
|
+
fieldName: 'slider'
|
|
1614
|
+
}, props);
|
|
1109
1615
|
var render = useOnChange(Object.assign({}, props));
|
|
1110
1616
|
return render(antd.Slider);
|
|
1111
1617
|
};
|
|
1112
|
-
Slider.
|
|
1113
|
-
fieldName: 'slider'
|
|
1114
|
-
};
|
|
1618
|
+
Slider.Field = antd.Slider;
|
|
1115
1619
|
|
|
1116
1620
|
var ResetButton = function ResetButton(props) {
|
|
1117
1621
|
var resetProps = ReactForm.useReset();
|
|
@@ -1159,7 +1663,6 @@ var CancelButton = function CancelButton(_ref) {
|
|
|
1159
1663
|
|
|
1160
1664
|
var FormAntd = Form;
|
|
1161
1665
|
var fields = {
|
|
1162
|
-
Upload: UploadInput,
|
|
1163
1666
|
TreeSelect: _TreeSelect,
|
|
1164
1667
|
TimePicker: _TimePicker,
|
|
1165
1668
|
TextArea: TextArea,
|
|
@@ -1173,7 +1676,6 @@ var fields = {
|
|
|
1173
1676
|
CheckboxGroup: CheckboxGroup,
|
|
1174
1677
|
Checkbox: Checkbox,
|
|
1175
1678
|
Cascader: Cascader,
|
|
1176
|
-
Avatar: AvatarInput,
|
|
1177
1679
|
Rate: Rate,
|
|
1178
1680
|
Slider: Slider
|
|
1179
1681
|
};
|
|
@@ -1190,7 +1692,6 @@ Object.defineProperty(exports, 'widget', {
|
|
|
1190
1692
|
enumerable: true,
|
|
1191
1693
|
get: function () { return reactFormHelper.widget; }
|
|
1192
1694
|
});
|
|
1193
|
-
exports.Avatar = AvatarInput;
|
|
1194
1695
|
exports.CancelButton = CancelButton;
|
|
1195
1696
|
exports.Cascader = Cascader;
|
|
1196
1697
|
exports.Checkbox = Checkbox;
|
|
@@ -1210,7 +1711,6 @@ exports.Switch = Switch;
|
|
|
1210
1711
|
exports.TextArea = TextArea;
|
|
1211
1712
|
exports.TimePicker = _TimePicker;
|
|
1212
1713
|
exports.TreeSelect = _TreeSelect;
|
|
1213
|
-
exports.Upload = UploadInput;
|
|
1214
1714
|
exports["default"] = Form;
|
|
1215
1715
|
exports.fields = fields;
|
|
1216
1716
|
exports.preset = preset;
|