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