@hw-component/form 0.0.1-beta → 0.0.1-beta-v2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/CheckboxGroup/CheckBox/index.js +16 -24
- package/es/CheckboxGroup/hooks.d.ts +3 -9
- package/es/CheckboxGroup/hooks.js +64 -115
- package/es/CheckboxGroup/index.d.ts +1 -6
- package/es/CheckboxGroup/index.js +58 -117
- package/es/CheckboxGroup/modal.d.ts +8 -9
- package/es/Form/Context/FormConfigProvider.js +19 -64
- package/es/Form/Context/index.d.ts +1 -4
- package/es/Form/Context/index.js +3 -3
- package/es/Form/FormItem/BasicItem.js +42 -80
- package/es/Form/FormItem/Helper.d.ts +1 -1
- package/es/Form/FormItem/Helper.js +9 -17
- package/es/Form/FormItem/RegularFormItem.js +8 -11
- package/es/Form/FormItem/UpFormItem.d.ts +1 -6
- package/es/Form/FormItem/UpFormItem.js +17 -27
- package/es/Form/FormItem/hooks.d.ts +4 -21
- package/es/Form/FormItem/hooks.js +9 -12
- package/es/Form/FormItem/index.js +5 -5
- package/es/Form/HFormConnect.d.ts +1 -9
- package/es/Form/HFormConnect.js +30 -90
- package/es/Form/InitSet.d.ts +1 -4
- package/es/Form/InitSet.js +6 -7
- package/es/Form/Label.d.ts +4 -4
- package/es/Form/Label.js +19 -36
- package/es/Form/config.d.ts +22 -100
- package/es/Form/config.js +19 -19
- package/es/Form/hooks/index.d.ts +1 -14
- package/es/Form/hooks/index.js +32 -80
- package/es/Form/hooks/useHForm.js +143 -224
- package/es/Form/hooks/useInitConfigData.d.ts +1 -4
- package/es/Form/hooks/useInitConfigData.js +61 -143
- package/es/Form/index.d.ts +1 -11
- package/es/Form/index.js +79 -79
- package/es/Form/modal.d.ts +54 -89
- package/es/Input/ButtonInput.js +51 -73
- package/es/Input/InputNumber.js +12 -21
- package/es/Input/SelectInput.d.ts +4 -16
- package/es/Input/SelectInput.js +62 -116
- package/es/Input/defaultConfig.d.ts +3 -3
- package/es/Input/defaultConfig.js +2 -2
- package/es/Input/index.js +7 -7
- package/es/Input/modal.d.ts +13 -15
- package/es/ModalForm/hooks.d.ts +12 -0
- package/es/ModalForm/hooks.js +63 -0
- package/es/ModalForm/index.d.ts +4 -0
- package/es/ModalForm/index.js +72 -0
- package/es/ModalForm/modal.d.ts +20 -0
- package/es/PageHandler/ErrorComponent.js +25 -47
- package/es/PageHandler/LoadingComponent.js +13 -17
- package/es/PageHandler/index.js +7 -7
- package/es/PageHandler/modal.d.ts +4 -4
- package/es/RadioGroup/index.d.ts +5 -12
- package/es/RadioGroup/index.js +33 -46
- package/es/Select/components/AllSelect.d.ts +1 -1
- package/es/Select/components/AllSelect.js +18 -40
- package/es/Select/components/CheckBoxOption.d.ts +3 -6
- package/es/Select/components/CheckBoxOption.js +7 -12
- package/es/Select/components/DropdownComponent.d.ts +4 -4
- package/es/Select/components/DropdownComponent.js +17 -30
- package/es/Select/components/NoFindItem.d.ts +1 -1
- package/es/Select/components/NoFindItem.js +7 -11
- package/es/Select/components/NotFoundContent.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +27 -49
- package/es/Select/defaultConfig.d.ts +1 -1
- package/es/Select/defaultConfig.js +16 -20
- package/es/Select/hooks/changeHooks.d.ts +2 -2
- package/es/Select/hooks/changeHooks.js +71 -147
- package/es/Select/hooks/norHooks.d.ts +9 -27
- package/es/Select/hooks/norHooks.js +39 -51
- package/es/Select/index.d.ts +1 -22
- package/es/Select/index.js +65 -124
- package/es/Select/modal.d.ts +15 -15
- package/es/Select/utils.js +15 -60
- package/es/Submit/index.d.ts +3 -9
- package/es/Submit/index.js +13 -18
- package/es/Switch/index.d.ts +4 -4
- package/es/Switch/index.js +20 -46
- package/es/TDPicker/RangePicker.d.ts +3 -8
- package/es/TDPicker/RangePicker.js +67 -138
- package/es/TDPicker/TimePicker.d.ts +1 -6
- package/es/TDPicker/TimePicker.js +13 -19
- package/es/TDPicker/hooks.d.ts +22 -42
- package/es/TDPicker/hooks.js +72 -106
- package/es/TDPicker/index.d.ts +1 -7
- package/es/TDPicker/index.js +14 -20
- package/es/TDPicker/modal.d.ts +16 -21
- package/es/TextArea/index.d.ts +1 -0
- package/es/Upload/Btn.d.ts +1 -5
- package/es/Upload/Btn.js +19 -35
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +5 -10
- package/es/Upload/MediaTypeEle/TypeEle.js +23 -31
- package/es/Upload/MediaTypeEle/index.d.ts +1 -5
- package/es/Upload/MediaTypeEle/index.js +18 -21
- package/es/Upload/Preview/index.d.ts +1 -5
- package/es/Upload/Preview/index.js +13 -17
- package/es/Upload/UrlUpload/index.d.ts +1 -7
- package/es/Upload/UrlUpload/index.js +51 -72
- package/es/Upload/enums.d.ts +3 -3
- package/es/Upload/enums.js +3 -3
- package/es/Upload/hooks/change.d.ts +1 -8
- package/es/Upload/hooks/change.js +58 -115
- package/es/Upload/hooks/customRequest.d.ts +1 -5
- package/es/Upload/hooks/customRequest.js +46 -63
- package/es/Upload/hooks/propsMaker.d.ts +1 -5
- package/es/Upload/hooks/propsMaker.js +13 -52
- package/es/Upload/index.d.ts +1 -3
- package/es/Upload/index.js +61 -131
- package/es/Upload/modal.d.ts +15 -17
- package/es/Upload/util.d.ts +2 -8
- package/es/Upload/util.js +7 -15
- package/es/config.js +31 -34
- package/es/hooks/index.d.ts +7 -14
- package/es/hooks/index.js +49 -124
- package/es/index.d.ts +18 -98
- package/es/index.js +8 -22
- package/es/modal.d.ts +6 -6
- package/lib/CheckboxGroup/CheckBox/index.js +18 -26
- package/lib/CheckboxGroup/hooks.d.ts +3 -9
- package/lib/CheckboxGroup/hooks.js +65 -116
- package/lib/CheckboxGroup/index.d.ts +1 -6
- package/lib/CheckboxGroup/index.js +60 -119
- package/lib/CheckboxGroup/modal.d.ts +8 -9
- package/lib/Form/Context/FormConfigProvider.js +21 -66
- package/lib/Form/Context/index.d.ts +1 -4
- package/lib/Form/Context/index.js +4 -4
- package/lib/Form/FormItem/BasicItem.js +44 -82
- package/lib/Form/FormItem/Helper.d.ts +1 -1
- package/lib/Form/FormItem/Helper.js +11 -19
- package/lib/Form/FormItem/RegularFormItem.js +10 -13
- package/lib/Form/FormItem/UpFormItem.d.ts +1 -6
- package/lib/Form/FormItem/UpFormItem.js +19 -29
- package/lib/Form/FormItem/hooks.d.ts +4 -21
- package/lib/Form/FormItem/hooks.js +10 -13
- package/lib/Form/FormItem/index.js +7 -7
- package/lib/Form/HFormConnect.d.ts +1 -9
- package/lib/Form/HFormConnect.js +32 -92
- package/lib/Form/InitSet.d.ts +1 -4
- package/lib/Form/InitSet.js +8 -9
- package/lib/Form/Label.d.ts +4 -4
- package/lib/Form/Label.js +21 -41
- package/lib/Form/config.d.ts +22 -100
- package/lib/Form/config.js +21 -21
- package/lib/Form/hooks/index.d.ts +1 -14
- package/lib/Form/hooks/index.js +32 -81
- package/lib/Form/hooks/useHForm.js +145 -226
- package/lib/Form/hooks/useInitConfigData.d.ts +1 -4
- package/lib/Form/hooks/useInitConfigData.js +63 -144
- package/lib/Form/index.d.ts +1 -11
- package/lib/Form/index.js +83 -83
- package/lib/Form/modal.d.ts +54 -89
- package/lib/Input/ButtonInput.js +53 -75
- package/lib/Input/InputNumber.js +14 -23
- package/lib/Input/SelectInput.d.ts +4 -16
- package/lib/Input/SelectInput.js +66 -128
- package/lib/Input/defaultConfig.d.ts +3 -3
- package/lib/Input/defaultConfig.js +3 -3
- package/lib/Input/index.js +9 -9
- package/lib/Input/modal.d.ts +13 -15
- package/lib/ModalForm/hooks.d.ts +12 -0
- package/lib/ModalForm/hooks.js +66 -0
- package/lib/ModalForm/index.d.ts +4 -0
- package/lib/ModalForm/index.js +75 -0
- package/lib/ModalForm/modal.d.ts +20 -0
- package/lib/PageHandler/ErrorComponent.js +27 -49
- package/lib/PageHandler/LoadingComponent.js +15 -19
- package/lib/PageHandler/index.js +9 -9
- package/lib/PageHandler/modal.d.ts +4 -4
- package/lib/RadioGroup/index.d.ts +5 -12
- package/lib/RadioGroup/index.js +35 -48
- package/lib/Select/components/AllSelect.d.ts +1 -1
- package/lib/Select/components/AllSelect.js +20 -42
- package/lib/Select/components/CheckBoxOption.d.ts +3 -6
- package/lib/Select/components/CheckBoxOption.js +9 -14
- package/lib/Select/components/DropdownComponent.d.ts +4 -4
- package/lib/Select/components/DropdownComponent.js +19 -32
- package/lib/Select/components/NoFindItem.d.ts +1 -1
- package/lib/Select/components/NoFindItem.js +9 -13
- package/lib/Select/components/NotFoundContent.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +29 -51
- package/lib/Select/defaultConfig.d.ts +1 -1
- package/lib/Select/defaultConfig.js +17 -21
- package/lib/Select/hooks/changeHooks.d.ts +2 -2
- package/lib/Select/hooks/changeHooks.js +72 -148
- package/lib/Select/hooks/norHooks.d.ts +9 -27
- package/lib/Select/hooks/norHooks.js +40 -52
- package/lib/Select/index.d.ts +1 -22
- package/lib/Select/index.js +67 -128
- package/lib/Select/modal.d.ts +15 -15
- package/lib/Select/utils.js +16 -61
- package/lib/Submit/index.d.ts +3 -9
- package/lib/Submit/index.js +15 -20
- package/lib/Switch/index.d.ts +4 -4
- package/lib/Switch/index.js +22 -48
- package/lib/TDPicker/RangePicker.d.ts +3 -8
- package/lib/TDPicker/RangePicker.js +69 -136
- package/lib/TDPicker/TimePicker.d.ts +1 -6
- package/lib/TDPicker/TimePicker.js +15 -21
- package/lib/TDPicker/hooks.d.ts +22 -42
- package/lib/TDPicker/hooks.js +72 -98
- package/lib/TDPicker/index.d.ts +1 -7
- package/lib/TDPicker/index.js +16 -22
- package/lib/TDPicker/modal.d.ts +16 -21
- package/lib/TextArea/index.d.ts +1 -0
- package/lib/Upload/Btn.d.ts +1 -5
- package/lib/Upload/Btn.js +21 -37
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +5 -10
- package/lib/Upload/MediaTypeEle/TypeEle.js +25 -33
- package/lib/Upload/MediaTypeEle/index.d.ts +1 -5
- package/lib/Upload/MediaTypeEle/index.js +20 -23
- package/lib/Upload/Preview/index.d.ts +1 -5
- package/lib/Upload/Preview/index.js +15 -19
- package/lib/Upload/UrlUpload/index.d.ts +1 -7
- package/lib/Upload/UrlUpload/index.js +53 -74
- package/lib/Upload/enums.d.ts +3 -3
- package/lib/Upload/enums.js +4 -4
- package/lib/Upload/hooks/change.d.ts +1 -8
- package/lib/Upload/hooks/change.js +59 -116
- package/lib/Upload/hooks/customRequest.d.ts +1 -5
- package/lib/Upload/hooks/customRequest.js +47 -64
- package/lib/Upload/hooks/propsMaker.d.ts +1 -5
- package/lib/Upload/hooks/propsMaker.js +15 -55
- package/lib/Upload/index.d.ts +1 -3
- package/lib/Upload/index.js +63 -133
- package/lib/Upload/modal.d.ts +15 -17
- package/lib/Upload/util.d.ts +2 -8
- package/lib/Upload/util.js +8 -16
- package/lib/config.js +32 -35
- package/lib/hooks/index.d.ts +7 -14
- package/lib/hooks/index.js +50 -125
- package/lib/index.d.ts +18 -98
- package/lib/index.js +10 -5
- package/lib/modal.d.ts +6 -6
- package/package.json +1 -1
- package/src/components/Form/InitSet.tsx +3 -5
- package/src/components/Form/hooks/index.ts +0 -20
- package/src/components/Form/hooks/useHForm.ts +8 -4
- package/src/components/Form/index.tsx +25 -7
- package/src/components/Form/modal.ts +4 -2
- package/src/components/Input/SelectInput.tsx +3 -2
- package/src/components/Input/modal.ts +2 -0
- package/src/components/ModalForm/hooks.ts +45 -0
- package/src/components/ModalForm/index.tsx +69 -0
- package/src/components/ModalForm/modal.ts +22 -0
- package/src/components/index.tsx +4 -0
- package/src/pages/ModalForm/index.tsx +127 -0
- package/src/routes.tsx +6 -1
|
@@ -1,71 +1,31 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _asyncToGenerator from
|
|
3
|
-
import _defineProperty from
|
|
4
|
-
import _regeneratorRuntime from
|
|
5
|
-
import _everyInstanceProperty from
|
|
6
|
-
import _forEachInstanceProperty from
|
|
7
|
-
import _Object$keys from
|
|
8
|
-
import _Object$getOwnPropertySymbols from
|
|
9
|
-
import _filterInstanceProperty from
|
|
10
|
-
import _Object$getOwnPropertyDescriptor from
|
|
11
|
-
import _Object$getOwnPropertyDescriptors from
|
|
12
|
-
import _Object$defineProperties from
|
|
13
|
-
import _Object$defineProperty from
|
|
14
|
-
import { useRequest } from
|
|
15
|
-
import { useCustomRequest } from
|
|
16
|
-
import { checkFileSize, checkFileType } from
|
|
17
|
-
import { message } from
|
|
2
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
3
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
4
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
5
|
+
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js/instance/every';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
7
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
8
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
9
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
10
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
11
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
12
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
13
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
14
|
+
import { useRequest } from 'ahooks';
|
|
15
|
+
import { useCustomRequest } from './customRequest.js';
|
|
16
|
+
import { checkFileSize, checkFileType } from '../util.js';
|
|
17
|
+
import { message } from 'antd';
|
|
18
18
|
|
|
19
|
-
function ownKeys(object, enumerableOnly) {
|
|
20
|
-
|
|
21
|
-
if (_Object$getOwnPropertySymbols) {
|
|
22
|
-
var symbols = _Object$getOwnPropertySymbols(object);
|
|
23
|
-
enumerableOnly &&
|
|
24
|
-
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
25
|
-
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
26
|
-
})),
|
|
27
|
-
keys.push.apply(keys, symbols);
|
|
28
|
-
}
|
|
29
|
-
return keys;
|
|
30
|
-
}
|
|
31
|
-
function _objectSpread(target) {
|
|
32
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
33
|
-
var _context2, _context3;
|
|
34
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
35
|
-
i % 2
|
|
36
|
-
? _forEachInstanceProperty(
|
|
37
|
-
(_context2 = ownKeys(Object(source), !0))
|
|
38
|
-
).call(_context2, function (key) {
|
|
39
|
-
_defineProperty(target, key, source[key]);
|
|
40
|
-
})
|
|
41
|
-
: _Object$getOwnPropertyDescriptors
|
|
42
|
-
? _Object$defineProperties(
|
|
43
|
-
target,
|
|
44
|
-
_Object$getOwnPropertyDescriptors(source)
|
|
45
|
-
)
|
|
46
|
-
: _forEachInstanceProperty((_context3 = ownKeys(Object(source)))).call(
|
|
47
|
-
_context3,
|
|
48
|
-
function (key) {
|
|
49
|
-
_Object$defineProperty(
|
|
50
|
-
target,
|
|
51
|
-
key,
|
|
52
|
-
_Object$getOwnPropertyDescriptor(source, key)
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
return target;
|
|
58
|
-
}
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
59
21
|
var checkFile = function checkFile(item) {
|
|
60
|
-
var oldFile =
|
|
61
|
-
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
22
|
+
var oldFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
62
23
|
return _everyInstanceProperty(oldFile).call(oldFile, function (oldItem) {
|
|
63
24
|
return item.uid !== oldItem.uid;
|
|
64
25
|
});
|
|
65
26
|
};
|
|
66
27
|
var matchFile = function matchFile(newFile) {
|
|
67
|
-
var oldFile =
|
|
68
|
-
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
28
|
+
var oldFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
69
29
|
var exFiles = arguments.length > 2 ? arguments[2] : undefined;
|
|
70
30
|
var maxSize = arguments.length > 3 ? arguments[3] : undefined;
|
|
71
31
|
var newResultFileList = [];
|
|
@@ -80,15 +40,9 @@ var matchFile = function matchFile(newFile) {
|
|
|
80
40
|
}
|
|
81
41
|
if (checkFile(item, oldFile)) {
|
|
82
42
|
addFile.push(item);
|
|
83
|
-
newResultFileList.push(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{},
|
|
87
|
-
{
|
|
88
|
-
status: "uploading",
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
);
|
|
43
|
+
newResultFileList.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
44
|
+
status: "uploading"
|
|
45
|
+
}));
|
|
92
46
|
} else {
|
|
93
47
|
newResultFileList.push(item);
|
|
94
48
|
}
|
|
@@ -96,7 +50,7 @@ var matchFile = function matchFile(newFile) {
|
|
|
96
50
|
return {
|
|
97
51
|
addFile: addFile,
|
|
98
52
|
fileList: newResultFileList,
|
|
99
|
-
errList: errList
|
|
53
|
+
errList: errList
|
|
100
54
|
};
|
|
101
55
|
};
|
|
102
56
|
var useChange = function useChange(_ref) {
|
|
@@ -110,52 +64,41 @@ var useChange = function useChange(_ref) {
|
|
|
110
64
|
var customRequest = useCustomRequest({
|
|
111
65
|
request: request,
|
|
112
66
|
onChange: onChange,
|
|
113
|
-
value: value
|
|
67
|
+
value: value
|
|
114
68
|
});
|
|
115
|
-
var _useRequest = useRequest(
|
|
116
|
-
/*#__PURE__*/
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
})
|
|
149
|
-
);
|
|
150
|
-
return function (_x) {
|
|
151
|
-
return _ref3.apply(this, arguments);
|
|
152
|
-
};
|
|
153
|
-
})(),
|
|
154
|
-
{
|
|
155
|
-
manual: true,
|
|
156
|
-
debounceInterval: 100,
|
|
157
|
-
}
|
|
158
|
-
),
|
|
69
|
+
var _useRequest = useRequest( /*#__PURE__*/function () {
|
|
70
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
71
|
+
var fileList, _matchFile, addFile, newFileList, errList;
|
|
72
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
73
|
+
while (1) switch (_context.prev = _context.next) {
|
|
74
|
+
case 0:
|
|
75
|
+
fileList = _ref2.fileList;
|
|
76
|
+
if (!(fileList.length > maxCount)) {
|
|
77
|
+
_context.next = 4;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
message.error("超出最多文件限制!");
|
|
81
|
+
return _context.abrupt("return");
|
|
82
|
+
case 4:
|
|
83
|
+
_matchFile = matchFile(fileList, value, exFiles, maxSize), addFile = _matchFile.addFile, newFileList = _matchFile.fileList, errList = _matchFile.errList;
|
|
84
|
+
if (errList.length) {
|
|
85
|
+
message.error(errList[0].message);
|
|
86
|
+
}
|
|
87
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newFileList);
|
|
88
|
+
customRequest(addFile);
|
|
89
|
+
case 8:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context.stop();
|
|
92
|
+
}
|
|
93
|
+
}, _callee);
|
|
94
|
+
}));
|
|
95
|
+
return function (_x) {
|
|
96
|
+
return _ref3.apply(this, arguments);
|
|
97
|
+
};
|
|
98
|
+
}(), {
|
|
99
|
+
manual: true,
|
|
100
|
+
debounceInterval: 100
|
|
101
|
+
}),
|
|
159
102
|
run = _useRequest.run;
|
|
160
103
|
return function (info) {
|
|
161
104
|
run(info);
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import type { IUpLoadProps } from "../modal";
|
|
2
2
|
import type { UploadFile } from "antd/es/upload/interface";
|
|
3
|
-
export declare const useCustomRequest: ({
|
|
4
|
-
value,
|
|
5
|
-
request,
|
|
6
|
-
onChange,
|
|
7
|
-
}: IUpLoadProps) => (fileList: UploadFile[]) => void;
|
|
3
|
+
export declare const useCustomRequest: ({ value, request, onChange, }: IUpLoadProps) => (fileList: UploadFile[]) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _asyncToGenerator from
|
|
3
|
-
import _regeneratorRuntime from
|
|
4
|
-
import _mapInstanceProperty from
|
|
5
|
-
import _forEachInstanceProperty from
|
|
6
|
-
import { useMemo, useEffect } from
|
|
2
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
3
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
4
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
5
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
6
|
+
import { useMemo, useEffect } from 'react';
|
|
7
7
|
|
|
8
8
|
var useCustomRequest = function useCustomRequest(_ref) {
|
|
9
9
|
var value = _ref.value,
|
|
@@ -11,70 +11,53 @@ var useCustomRequest = function useCustomRequest(_ref) {
|
|
|
11
11
|
onChange = _ref.onChange;
|
|
12
12
|
var valObj = useMemo(function () {
|
|
13
13
|
return {
|
|
14
|
-
value: value
|
|
14
|
+
value: value
|
|
15
15
|
};
|
|
16
16
|
}, []);
|
|
17
|
-
useEffect(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
uid = file.uid;
|
|
33
|
-
url = "";
|
|
34
|
-
if (!request) {
|
|
35
|
-
_context.next = 7;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
_context.next = 5;
|
|
39
|
-
return request(file);
|
|
40
|
-
case 5:
|
|
41
|
-
result = _context.sent;
|
|
42
|
-
url = result.url;
|
|
43
|
-
case 7:
|
|
44
|
-
fileList =
|
|
45
|
-
valObj === null || valObj === void 0
|
|
46
|
-
? void 0
|
|
47
|
-
: (_valObj$value = valObj.value) === null ||
|
|
48
|
-
_valObj$value === void 0
|
|
49
|
-
? void 0
|
|
50
|
-
: _mapInstanceProperty(_valObj$value).call(
|
|
51
|
-
_valObj$value,
|
|
52
|
-
function (item) {
|
|
53
|
-
var resultUrl = url || item.thumbUrl;
|
|
54
|
-
if (item.uid === uid) {
|
|
55
|
-
item.status = "done";
|
|
56
|
-
item.response = {
|
|
57
|
-
url: resultUrl,
|
|
58
|
-
};
|
|
59
|
-
return item;
|
|
60
|
-
}
|
|
61
|
-
return item;
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
onChange === null || onChange === void 0
|
|
65
|
-
? void 0
|
|
66
|
-
: onChange(fileList || []);
|
|
67
|
-
case 9:
|
|
68
|
-
case "end":
|
|
69
|
-
return _context.stop();
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
valObj.value = value;
|
|
19
|
+
}, [value]);
|
|
20
|
+
var sendFile = /*#__PURE__*/function () {
|
|
21
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
|
|
22
|
+
var _valObj$value;
|
|
23
|
+
var uid, url, result, fileList;
|
|
24
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
uid = file.uid;
|
|
28
|
+
url = "";
|
|
29
|
+
if (!request) {
|
|
30
|
+
_context.next = 7;
|
|
31
|
+
break;
|
|
70
32
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
33
|
+
_context.next = 5;
|
|
34
|
+
return request(file);
|
|
35
|
+
case 5:
|
|
36
|
+
result = _context.sent;
|
|
37
|
+
url = result.url;
|
|
38
|
+
case 7:
|
|
39
|
+
fileList = valObj === null || valObj === void 0 ? void 0 : (_valObj$value = valObj.value) === null || _valObj$value === void 0 ? void 0 : _mapInstanceProperty(_valObj$value).call(_valObj$value, function (item) {
|
|
40
|
+
var resultUrl = url || item.thumbUrl;
|
|
41
|
+
if (item.uid === uid) {
|
|
42
|
+
item.status = "done";
|
|
43
|
+
item.response = {
|
|
44
|
+
url: resultUrl
|
|
45
|
+
};
|
|
46
|
+
return item;
|
|
47
|
+
}
|
|
48
|
+
return item;
|
|
49
|
+
});
|
|
50
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(fileList || []);
|
|
51
|
+
case 9:
|
|
52
|
+
case "end":
|
|
53
|
+
return _context.stop();
|
|
54
|
+
}
|
|
55
|
+
}, _callee);
|
|
56
|
+
}));
|
|
74
57
|
return function sendFile(_x) {
|
|
75
58
|
return _ref2.apply(this, arguments);
|
|
76
59
|
};
|
|
77
|
-
}
|
|
60
|
+
}();
|
|
78
61
|
return function (fileList) {
|
|
79
62
|
_forEachInstanceProperty(fileList).call(fileList, function (item) {
|
|
80
63
|
sendFile(item);
|
|
@@ -1,56 +1,17 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _Object$getOwnPropertySymbols from
|
|
3
|
-
import _filterInstanceProperty from
|
|
4
|
-
import _Object$getOwnPropertyDescriptor from
|
|
5
|
-
import _Object$getOwnPropertyDescriptors from
|
|
6
|
-
import _Object$defineProperties from
|
|
7
|
-
import _Object$defineProperty from
|
|
8
|
-
import _defineProperty from
|
|
9
|
-
import _Object$keys from
|
|
10
|
-
import _forEachInstanceProperty from
|
|
11
|
-
import { useFormConfigContext } from
|
|
2
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
3
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
5
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
6
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
7
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
8
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
9
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
10
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
11
|
+
import { useFormConfigContext } from '../../Form/Context/FormConfigProvider.js';
|
|
12
12
|
|
|
13
|
-
function ownKeys(object, enumerableOnly) {
|
|
14
|
-
|
|
15
|
-
if (_Object$getOwnPropertySymbols) {
|
|
16
|
-
var symbols = _Object$getOwnPropertySymbols(object);
|
|
17
|
-
enumerableOnly &&
|
|
18
|
-
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
19
|
-
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
20
|
-
})),
|
|
21
|
-
keys.push.apply(keys, symbols);
|
|
22
|
-
}
|
|
23
|
-
return keys;
|
|
24
|
-
}
|
|
25
|
-
function _objectSpread(target) {
|
|
26
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
27
|
-
var _context, _context2;
|
|
28
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
29
|
-
i % 2
|
|
30
|
-
? _forEachInstanceProperty((_context = ownKeys(Object(source), !0))).call(
|
|
31
|
-
_context,
|
|
32
|
-
function (key) {
|
|
33
|
-
_defineProperty(target, key, source[key]);
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
: _Object$getOwnPropertyDescriptors
|
|
37
|
-
? _Object$defineProperties(
|
|
38
|
-
target,
|
|
39
|
-
_Object$getOwnPropertyDescriptors(source)
|
|
40
|
-
)
|
|
41
|
-
: _forEachInstanceProperty((_context2 = ownKeys(Object(source)))).call(
|
|
42
|
-
_context2,
|
|
43
|
-
function (key) {
|
|
44
|
-
_Object$defineProperty(
|
|
45
|
-
target,
|
|
46
|
-
key,
|
|
47
|
-
_Object$getOwnPropertyDescriptor(source, key)
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
return target;
|
|
53
|
-
}
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
54
15
|
var useProps = function useProps(_ref) {
|
|
55
16
|
var request = _ref.request,
|
|
56
17
|
exFiles = _ref.exFiles,
|
|
@@ -59,7 +20,7 @@ var useProps = function useProps(_ref) {
|
|
|
59
20
|
var inputProps = {
|
|
60
21
|
request: request,
|
|
61
22
|
exFiles: exFiles,
|
|
62
|
-
maxSize: maxSize
|
|
23
|
+
maxSize: maxSize
|
|
63
24
|
};
|
|
64
25
|
var keys = _Object$keys(inputProps);
|
|
65
26
|
var resultProps = _objectSpread({}, configUploadProps);
|
package/es/Upload/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { IUpLoadProps, IUploadRefModal } from "./modal";
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<
|
|
4
|
-
IUpLoadProps & React.RefAttributes<IUploadRefModal>
|
|
5
|
-
>;
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<IUpLoadProps & React.RefAttributes<IUploadRefModal>>;
|
|
6
4
|
export default _default;
|