@hw-component/form 0.0.1-beta → 0.0.1-beta-v3
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 +78 -0
- package/es/ModalForm/index.d.ts +4 -0
- package/es/ModalForm/index.js +59 -0
- package/es/ModalForm/modal.d.ts +23 -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 +81 -0
- package/lib/ModalForm/index.d.ts +4 -0
- package/lib/ModalForm/index.js +62 -0
- package/lib/ModalForm/modal.d.ts +23 -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 +61 -0
- package/src/components/ModalForm/index.tsx +52 -0
- package/src/components/ModalForm/modal.ts +25 -0
- package/src/components/index.tsx +4 -0
- package/src/pages/ModalForm/index.tsx +127 -0
- package/src/routes.tsx +6 -1
package/lib/Upload/index.js
CHANGED
|
@@ -1,78 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _Object$keys = require(
|
|
6
|
-
var _Object$getOwnPropertySymbols = require(
|
|
7
|
-
var _filterInstanceProperty = require(
|
|
8
|
-
var _Object$getOwnPropertyDescriptor = require(
|
|
9
|
-
var _forEachInstanceProperty = require(
|
|
10
|
-
var _Object$getOwnPropertyDescriptors = require(
|
|
11
|
-
var _Object$defineProperties = require(
|
|
12
|
-
var _Object$defineProperty = require(
|
|
13
|
-
var _extends = require(
|
|
14
|
-
var _defineProperty = require(
|
|
15
|
-
var _slicedToArray = require(
|
|
16
|
-
var _objectWithoutProperties = require(
|
|
17
|
-
var antd = require(
|
|
18
|
-
var Btn = require(
|
|
19
|
-
var React = require(
|
|
20
|
-
var index = require(
|
|
21
|
-
var change = require(
|
|
22
|
-
var propsMaker = require(
|
|
5
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
6
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
|
|
7
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
|
|
8
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
|
|
9
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
10
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptors');
|
|
11
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js/object/define-properties');
|
|
12
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js/object/define-property');
|
|
13
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
14
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
15
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
16
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
17
|
+
var antd = require('antd');
|
|
18
|
+
var Btn = require('./Btn.js');
|
|
19
|
+
var React = require('react');
|
|
20
|
+
var index = require('./Preview/index.js');
|
|
21
|
+
var change = require('./hooks/change.js');
|
|
22
|
+
var propsMaker = require('./hooks/propsMaker.js');
|
|
23
23
|
|
|
24
|
-
var _excluded = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"listType",
|
|
28
|
-
"exFiles",
|
|
29
|
-
"maxCount",
|
|
30
|
-
"maxRowNum",
|
|
31
|
-
"onPreview",
|
|
32
|
-
"request",
|
|
33
|
-
"maxSize",
|
|
34
|
-
];
|
|
35
|
-
function ownKeys(object, enumerableOnly) {
|
|
36
|
-
var keys = _Object$keys(object);
|
|
37
|
-
if (_Object$getOwnPropertySymbols) {
|
|
38
|
-
var symbols = _Object$getOwnPropertySymbols(object);
|
|
39
|
-
enumerableOnly &&
|
|
40
|
-
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
41
|
-
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
42
|
-
})),
|
|
43
|
-
keys.push.apply(keys, symbols);
|
|
44
|
-
}
|
|
45
|
-
return keys;
|
|
46
|
-
}
|
|
47
|
-
function _objectSpread(target) {
|
|
48
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
49
|
-
var _context, _context2;
|
|
50
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
51
|
-
i % 2
|
|
52
|
-
? _forEachInstanceProperty((_context = ownKeys(Object(source), !0))).call(
|
|
53
|
-
_context,
|
|
54
|
-
function (key) {
|
|
55
|
-
_defineProperty(target, key, source[key]);
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
: _Object$getOwnPropertyDescriptors
|
|
59
|
-
? _Object$defineProperties(
|
|
60
|
-
target,
|
|
61
|
-
_Object$getOwnPropertyDescriptors(source)
|
|
62
|
-
)
|
|
63
|
-
: _forEachInstanceProperty((_context2 = ownKeys(Object(source)))).call(
|
|
64
|
-
_context2,
|
|
65
|
-
function (key) {
|
|
66
|
-
_Object$defineProperty(
|
|
67
|
-
target,
|
|
68
|
-
key,
|
|
69
|
-
_Object$getOwnPropertyDescriptor(source, key)
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
return target;
|
|
75
|
-
}
|
|
24
|
+
var _excluded = ["value", "onChange", "listType", "exFiles", "maxCount", "maxRowNum", "onPreview", "request", "maxSize"];
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
76
27
|
var Index = function Index(_ref, ref) {
|
|
77
28
|
var _ref$value = _ref.value,
|
|
78
29
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
@@ -91,40 +42,31 @@ var Index = function Index(_ref, ref) {
|
|
|
91
42
|
var matchProps = propsMaker.useProps({
|
|
92
43
|
request: request,
|
|
93
44
|
exFiles: exFiles,
|
|
94
|
-
maxSize: maxSize
|
|
45
|
+
maxSize: maxSize
|
|
95
46
|
});
|
|
96
47
|
var _useState = React.useState({}),
|
|
97
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
98
49
|
previewModal = _useState2[0],
|
|
99
50
|
setPreviewModal = _useState2[1];
|
|
100
|
-
var change$1 = change.useChange(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
value: value,
|
|
106
|
-
maxCount: maxCount,
|
|
107
|
-
onChange: onChange,
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
);
|
|
51
|
+
var change$1 = change.useChange(_objectSpread(_objectSpread({}, matchProps), {}, {
|
|
52
|
+
value: value,
|
|
53
|
+
maxCount: maxCount,
|
|
54
|
+
onChange: onChange
|
|
55
|
+
}));
|
|
111
56
|
React.useImperativeHandle(ref, function () {
|
|
112
57
|
return {
|
|
113
|
-
change: change$1
|
|
58
|
+
change: change$1
|
|
114
59
|
};
|
|
115
60
|
});
|
|
116
|
-
var contentStyle = React.useMemo(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
[maxRowNum, listType]
|
|
127
|
-
);
|
|
61
|
+
var contentStyle = React.useMemo(function () {
|
|
62
|
+
if (listType !== "picture-card") {
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
width: 112 * maxRowNum,
|
|
67
|
+
maxWidth: "100%"
|
|
68
|
+
};
|
|
69
|
+
}, [maxRowNum, listType]);
|
|
128
70
|
var preview = function preview(file) {
|
|
129
71
|
if (onPreview) {
|
|
130
72
|
onPreview(file);
|
|
@@ -132,48 +74,36 @@ var Index = function Index(_ref, ref) {
|
|
|
132
74
|
}
|
|
133
75
|
setPreviewModal({
|
|
134
76
|
visible: true,
|
|
135
|
-
file: file
|
|
77
|
+
file: file
|
|
136
78
|
});
|
|
137
79
|
};
|
|
138
80
|
var maxNum = maxCount === 1 ? maxCount : Number.MAX_VALUE;
|
|
139
81
|
var visible = previewModal.visible,
|
|
140
82
|
previewFile = previewModal.file;
|
|
141
|
-
return /*#__PURE__*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
maxCount: maxCount,
|
|
164
|
-
listType: listType,
|
|
165
|
-
})
|
|
166
|
-
),
|
|
167
|
-
/*#__PURE__*/ React.createElement(index.default, {
|
|
168
|
-
visible: visible,
|
|
169
|
-
file: previewFile,
|
|
170
|
-
onCancel: function onCancel() {
|
|
171
|
-
setPreviewModal({});
|
|
172
|
-
},
|
|
173
|
-
})
|
|
174
|
-
);
|
|
83
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
style: contentStyle
|
|
85
|
+
}, /*#__PURE__*/React.createElement(antd.Upload, _extends({
|
|
86
|
+
listType: listType,
|
|
87
|
+
maxCount: maxNum,
|
|
88
|
+
fileList: value,
|
|
89
|
+
onPreview: preview,
|
|
90
|
+
onChange: change$1,
|
|
91
|
+
beforeUpload: function beforeUpload() {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}, props), /*#__PURE__*/React.createElement(Btn.default, {
|
|
95
|
+
value: value,
|
|
96
|
+
maxCount: maxCount,
|
|
97
|
+
listType: listType
|
|
98
|
+
})), /*#__PURE__*/React.createElement(index.default, {
|
|
99
|
+
visible: visible,
|
|
100
|
+
file: previewFile,
|
|
101
|
+
onCancel: function onCancel() {
|
|
102
|
+
setPreviewModal({});
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
175
105
|
};
|
|
176
|
-
var HUpload = /*#__PURE__*/
|
|
106
|
+
var HUpload = /*#__PURE__*/React.forwardRef(Index);
|
|
177
107
|
|
|
178
108
|
exports.default = HUpload;
|
|
179
109
|
// powered by h
|
package/lib/Upload/modal.d.ts
CHANGED
|
@@ -4,27 +4,25 @@ import type { BeforeUploadFileType, RcFile } from "rc-upload/lib/interface";
|
|
|
4
4
|
import type { UploadChangeParam } from "antd/lib/upload/interface";
|
|
5
5
|
import type { MediaTypeEnum } from "@/components/Upload/enums";
|
|
6
6
|
export interface IUpLoadProps extends Omit<UploadProps, "onChange"> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
maxRowNum?: number;
|
|
17
|
-
maxSize?: number;
|
|
7
|
+
exFiles?: string[];
|
|
8
|
+
request?: (file: Exclude<BeforeUploadFileType, File | boolean> | RcFile) => Promise<{
|
|
9
|
+
url: string;
|
|
10
|
+
}>;
|
|
11
|
+
errorType?: "alert" | "show";
|
|
12
|
+
onChange?: (fileList: UploadFile[]) => void;
|
|
13
|
+
value?: UploadFile[];
|
|
14
|
+
maxRowNum?: number;
|
|
15
|
+
maxSize?: number;
|
|
18
16
|
}
|
|
19
17
|
export interface IMediaTypeEleProps {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
file?: UploadFile;
|
|
19
|
+
onReady?: VoidFunction;
|
|
20
|
+
onError?: VoidFunction;
|
|
23
21
|
}
|
|
24
22
|
export interface IUploadRefModal {
|
|
25
|
-
|
|
23
|
+
change: (info: UploadChangeParam<UploadFile>) => void;
|
|
26
24
|
}
|
|
27
25
|
export interface IUrlUploadProps extends IUpLoadProps {
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
mediaType?: MediaTypeEnum;
|
|
30
28
|
}
|
package/lib/Upload/util.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { UploadFile } from "antd/es/upload/interface";
|
|
2
2
|
export declare const getFileExt: (file: UploadFile) => string;
|
|
3
|
-
export declare const checkFileType: (
|
|
4
|
-
|
|
5
|
-
exFiles?: string[]
|
|
6
|
-
) => boolean;
|
|
7
|
-
export declare const checkFileSize: (
|
|
8
|
-
file: UploadFile,
|
|
9
|
-
maxSize?: number
|
|
10
|
-
) => boolean;
|
|
3
|
+
export declare const checkFileType: (file: UploadFile, exFiles?: string[]) => boolean;
|
|
4
|
+
export declare const checkFileSize: (file: UploadFile, maxSize?: number) => boolean;
|
|
11
5
|
export declare const fileToBase64: (file: any) => Promise<unknown>;
|
package/lib/Upload/util.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
var _lastIndexOfInstanceProperty = require(
|
|
4
|
-
var _indexOfInstanceProperty = require(
|
|
5
|
-
var _Promise = require(
|
|
3
|
+
var _lastIndexOfInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/last-index-of');
|
|
4
|
+
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/index-of');
|
|
5
|
+
var _Promise = require('@babel/runtime-corejs3/core-js/promise');
|
|
6
6
|
|
|
7
7
|
var getFileExt = function getFileExt(file) {
|
|
8
8
|
var name = file.name;
|
|
@@ -10,14 +10,12 @@ var getFileExt = function getFileExt(file) {
|
|
|
10
10
|
return name.substring(index + 1).toUpperCase();
|
|
11
11
|
};
|
|
12
12
|
var checkFileType = function checkFileType(file) {
|
|
13
|
-
var exFiles =
|
|
14
|
-
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
13
|
+
var exFiles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
15
14
|
var exName = getFileExt(file);
|
|
16
15
|
return _indexOfInstanceProperty(exFiles).call(exFiles, exName) !== -1;
|
|
17
16
|
};
|
|
18
17
|
var checkFileSize = function checkFileSize(file) {
|
|
19
|
-
var maxSize =
|
|
20
|
-
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
18
|
+
var maxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
21
19
|
var _file$size = file.size,
|
|
22
20
|
size = _file$size === void 0 ? 0 : _file$size;
|
|
23
21
|
return size <= maxSize;
|
|
@@ -25,16 +23,10 @@ var checkFileSize = function checkFileSize(file) {
|
|
|
25
23
|
var fileToBase64 = function fileToBase64(file) {
|
|
26
24
|
return new _Promise(function (resolve) {
|
|
27
25
|
var reader = new FileReader();
|
|
28
|
-
reader.readAsDataURL(
|
|
29
|
-
file === null || file === void 0 ? void 0 : file.originFileObj
|
|
30
|
-
);
|
|
26
|
+
reader.readAsDataURL(file === null || file === void 0 ? void 0 : file.originFileObj);
|
|
31
27
|
reader.onload = function (e) {
|
|
32
28
|
var _e$target;
|
|
33
|
-
resolve(
|
|
34
|
-
(_e$target = e.target) === null || _e$target === void 0
|
|
35
|
-
? void 0
|
|
36
|
-
: _e$target.result
|
|
37
|
-
);
|
|
29
|
+
resolve((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result);
|
|
38
30
|
};
|
|
39
31
|
});
|
|
40
32
|
};
|
package/lib/config.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
var _asyncToGenerator = require(
|
|
4
|
-
var _regeneratorRuntime = require(
|
|
5
|
-
var moment = require(
|
|
6
|
-
var util = require(
|
|
3
|
+
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
4
|
+
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
5
|
+
var moment = require('moment');
|
|
6
|
+
var util = require('./Upload/util.js');
|
|
7
7
|
|
|
8
8
|
var baseConfig = {
|
|
9
9
|
fieldNames: {
|
|
10
10
|
label: "label",
|
|
11
|
-
value: "value"
|
|
11
|
+
value: "value"
|
|
12
12
|
},
|
|
13
13
|
valueCheckMap: {
|
|
14
14
|
checked: true,
|
|
15
|
-
noChecked: false
|
|
15
|
+
noChecked: false
|
|
16
16
|
},
|
|
17
17
|
valueSwitchMap: {
|
|
18
18
|
open: true,
|
|
19
|
-
close: false
|
|
19
|
+
close: false
|
|
20
20
|
},
|
|
21
21
|
valueRangePickerValueMap: {
|
|
22
22
|
start: function start(name) {
|
|
@@ -24,44 +24,41 @@ var baseConfig = {
|
|
|
24
24
|
},
|
|
25
25
|
end: function end(name) {
|
|
26
26
|
return "".concat(name, "EndTime");
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
},
|
|
29
29
|
dateRanges: {
|
|
30
30
|
最近三天: [moment().subtract(2, "days").startOf("days"), moment()],
|
|
31
31
|
最近七天: [moment().subtract(6, "days").startOf("days"), moment()],
|
|
32
|
-
最近三十天: [moment().subtract(29, "days").startOf("days"), moment()]
|
|
32
|
+
最近三十天: [moment().subtract(29, "days").startOf("days"), moment()]
|
|
33
33
|
},
|
|
34
34
|
uploadProps: {
|
|
35
35
|
exFiles: ["JPG", "PNG", "JPEG", "GIF"],
|
|
36
|
-
request:
|
|
37
|
-
var _request = _asyncToGenerator(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, _callee);
|
|
56
|
-
})
|
|
57
|
-
);
|
|
36
|
+
request: function () {
|
|
37
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
|
|
38
|
+
var url;
|
|
39
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
|
+
while (1) switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
_context.next = 2;
|
|
43
|
+
return util.fileToBase64(file);
|
|
44
|
+
case 2:
|
|
45
|
+
url = _context.sent;
|
|
46
|
+
return _context.abrupt("return", {
|
|
47
|
+
url: url
|
|
48
|
+
});
|
|
49
|
+
case 4:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}, _callee);
|
|
54
|
+
}));
|
|
58
55
|
function request(_x) {
|
|
59
56
|
return _request.apply(this, arguments);
|
|
60
57
|
}
|
|
61
58
|
return request;
|
|
62
|
-
}
|
|
63
|
-
maxSize: 1024 * 1024 * 1.8
|
|
64
|
-
}
|
|
59
|
+
}(),
|
|
60
|
+
maxSize: 1024 * 1024 * 1.8
|
|
61
|
+
}
|
|
65
62
|
};
|
|
66
63
|
|
|
67
64
|
exports.baseConfig = baseConfig;
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import type { SelectProps } from "antd";
|
|
2
2
|
import type { IFormConfigContextProps } from "../Form/modal";
|
|
3
3
|
interface UseChangeOptionsParams {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
options?: Record<string, any>[];
|
|
5
|
+
fieldNames?: SelectProps["fieldNames"];
|
|
6
6
|
}
|
|
7
|
-
export declare const useChangeOptions: ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
| {
|
|
12
|
-
label: any;
|
|
13
|
-
value: any;
|
|
14
|
-
}[]
|
|
15
|
-
| undefined;
|
|
7
|
+
export declare const useChangeOptions: ({ options, fieldNames, }: UseChangeOptionsParams) => {
|
|
8
|
+
label: any;
|
|
9
|
+
value: any;
|
|
10
|
+
}[] | undefined;
|
|
16
11
|
export declare const useClassName: (className: string | string[]) => string;
|
|
17
|
-
export declare const useMatchConfigProps: (
|
|
18
|
-
matchProps: IFormConfigContextProps
|
|
19
|
-
) => IFormConfigContextProps;
|
|
12
|
+
export declare const useMatchConfigProps: (matchProps: IFormConfigContextProps) => IFormConfigContextProps;
|
|
20
13
|
export {};
|