@hw-component/form 0.0.1-bate → 0.0.1-beta

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.
Files changed (229) hide show
  1. package/es/CheckboxGroup/CheckBox/index.js +24 -16
  2. package/es/CheckboxGroup/hooks.d.ts +9 -3
  3. package/es/CheckboxGroup/hooks.js +115 -64
  4. package/es/CheckboxGroup/index.d.ts +6 -1
  5. package/es/CheckboxGroup/index.js +117 -56
  6. package/es/CheckboxGroup/modal.d.ts +9 -8
  7. package/es/Form/Context/FormConfigProvider.js +64 -19
  8. package/es/Form/Context/index.d.ts +4 -1
  9. package/es/Form/Context/index.js +3 -3
  10. package/es/Form/FormItem/BasicItem.js +80 -42
  11. package/es/Form/FormItem/Helper.d.ts +1 -1
  12. package/es/Form/FormItem/Helper.js +17 -9
  13. package/es/Form/FormItem/RegularFormItem.js +11 -8
  14. package/es/Form/FormItem/UpFormItem.d.ts +6 -1
  15. package/es/Form/FormItem/UpFormItem.js +27 -17
  16. package/es/Form/FormItem/hooks.d.ts +21 -4
  17. package/es/Form/FormItem/hooks.js +12 -9
  18. package/es/Form/FormItem/index.js +5 -5
  19. package/es/Form/HFormConnect.d.ts +9 -1
  20. package/es/Form/HFormConnect.js +94 -26
  21. package/es/Form/InitSet.d.ts +1 -1
  22. package/es/Form/InitSet.js +5 -5
  23. package/es/Form/Label.d.ts +4 -4
  24. package/es/Form/Label.js +36 -19
  25. package/es/Form/config.d.ts +100 -22
  26. package/es/Form/config.js +19 -19
  27. package/es/Form/hooks/index.d.ts +12 -5
  28. package/es/Form/hooks/index.js +65 -49
  29. package/es/Form/hooks/useHForm.js +233 -95
  30. package/es/Form/hooks/useInitConfigData.d.ts +4 -1
  31. package/es/Form/hooks/useInitConfigData.js +143 -61
  32. package/es/Form/index.d.ts +11 -1
  33. package/es/Form/index.js +71 -40
  34. package/es/Form/modal.d.ts +92 -51
  35. package/es/Input/ButtonInput.js +73 -51
  36. package/es/Input/InputNumber.js +21 -12
  37. package/es/Input/SelectInput.d.ts +16 -4
  38. package/es/Input/SelectInput.js +113 -56
  39. package/es/Input/defaultConfig.d.ts +3 -3
  40. package/es/Input/defaultConfig.js +2 -2
  41. package/es/Input/index.js +7 -7
  42. package/es/Input/modal.d.ts +15 -11
  43. package/es/PageHandler/ErrorComponent.js +47 -25
  44. package/es/PageHandler/LoadingComponent.js +17 -13
  45. package/es/PageHandler/index.js +7 -7
  46. package/es/PageHandler/modal.d.ts +4 -4
  47. package/es/RadioGroup/index.d.ts +12 -5
  48. package/es/RadioGroup/index.js +46 -33
  49. package/es/Select/components/AllSelect.d.ts +1 -1
  50. package/es/Select/components/AllSelect.js +40 -18
  51. package/es/Select/components/CheckBoxOption.d.ts +6 -3
  52. package/es/Select/components/CheckBoxOption.js +12 -7
  53. package/es/Select/components/DropdownComponent.d.ts +4 -4
  54. package/es/Select/components/DropdownComponent.js +30 -17
  55. package/es/Select/components/NoFindItem.d.ts +1 -1
  56. package/es/Select/components/NoFindItem.js +11 -7
  57. package/es/Select/components/NotFoundContent.d.ts +2 -2
  58. package/es/Select/components/NotFoundContent.js +49 -27
  59. package/es/Select/defaultConfig.d.ts +1 -1
  60. package/es/Select/defaultConfig.js +20 -16
  61. package/es/Select/hooks/changeHooks.d.ts +2 -2
  62. package/es/Select/hooks/changeHooks.js +147 -71
  63. package/es/Select/hooks/norHooks.d.ts +27 -9
  64. package/es/Select/hooks/norHooks.js +51 -39
  65. package/es/Select/index.d.ts +22 -1
  66. package/es/Select/index.js +124 -65
  67. package/es/Select/modal.d.ts +15 -15
  68. package/es/Select/utils.js +60 -15
  69. package/es/Submit/index.d.ts +9 -3
  70. package/es/Submit/index.js +18 -13
  71. package/es/Switch/index.d.ts +4 -4
  72. package/es/Switch/index.js +46 -20
  73. package/es/TDPicker/RangePicker.d.ts +8 -3
  74. package/es/TDPicker/RangePicker.js +138 -62
  75. package/es/TDPicker/TimePicker.d.ts +6 -1
  76. package/es/TDPicker/TimePicker.js +19 -13
  77. package/es/TDPicker/hooks.d.ts +42 -22
  78. package/es/TDPicker/hooks.js +106 -72
  79. package/es/TDPicker/index.d.ts +7 -1
  80. package/es/TDPicker/index.js +20 -14
  81. package/es/TDPicker/modal.d.ts +21 -16
  82. package/es/Upload/Btn.d.ts +5 -1
  83. package/es/Upload/Btn.js +35 -19
  84. package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
  85. package/es/Upload/MediaTypeEle/TypeEle.js +31 -23
  86. package/es/Upload/MediaTypeEle/index.d.ts +5 -1
  87. package/es/Upload/MediaTypeEle/index.js +21 -18
  88. package/es/Upload/Preview/index.d.ts +5 -1
  89. package/es/Upload/Preview/index.js +17 -13
  90. package/es/Upload/UrlUpload/index.d.ts +7 -1
  91. package/es/Upload/UrlUpload/index.js +72 -51
  92. package/es/Upload/enums.d.ts +3 -3
  93. package/es/Upload/enums.js +3 -3
  94. package/es/Upload/hooks/change.d.ts +8 -1
  95. package/es/Upload/hooks/change.js +115 -58
  96. package/es/Upload/hooks/customRequest.d.ts +5 -1
  97. package/es/Upload/hooks/customRequest.js +63 -46
  98. package/es/Upload/hooks/propsMaker.d.ts +5 -1
  99. package/es/Upload/hooks/propsMaker.js +52 -13
  100. package/es/Upload/index.d.ts +3 -1
  101. package/es/Upload/index.js +131 -61
  102. package/es/Upload/modal.d.ts +17 -15
  103. package/es/Upload/util.d.ts +8 -2
  104. package/es/Upload/util.js +15 -7
  105. package/es/config.js +34 -31
  106. package/es/hooks/index.d.ts +14 -7
  107. package/es/hooks/index.js +124 -49
  108. package/es/index.d.ts +98 -16
  109. package/es/index.js +22 -5
  110. package/es/modal.d.ts +6 -6
  111. package/lib/CheckboxGroup/CheckBox/index.js +26 -18
  112. package/lib/CheckboxGroup/hooks.d.ts +9 -3
  113. package/lib/CheckboxGroup/hooks.js +116 -65
  114. package/lib/CheckboxGroup/index.d.ts +6 -1
  115. package/lib/CheckboxGroup/index.js +119 -58
  116. package/lib/CheckboxGroup/modal.d.ts +9 -8
  117. package/lib/Form/Context/FormConfigProvider.js +66 -21
  118. package/lib/Form/Context/index.d.ts +4 -1
  119. package/lib/Form/Context/index.js +4 -4
  120. package/lib/Form/FormItem/BasicItem.js +82 -44
  121. package/lib/Form/FormItem/Helper.d.ts +1 -1
  122. package/lib/Form/FormItem/Helper.js +19 -11
  123. package/lib/Form/FormItem/RegularFormItem.js +13 -10
  124. package/lib/Form/FormItem/UpFormItem.d.ts +6 -1
  125. package/lib/Form/FormItem/UpFormItem.js +29 -19
  126. package/lib/Form/FormItem/hooks.d.ts +21 -4
  127. package/lib/Form/FormItem/hooks.js +13 -10
  128. package/lib/Form/FormItem/index.js +7 -7
  129. package/lib/Form/HFormConnect.d.ts +9 -1
  130. package/lib/Form/HFormConnect.js +96 -28
  131. package/lib/Form/InitSet.d.ts +1 -1
  132. package/lib/Form/InitSet.js +7 -7
  133. package/lib/Form/Label.d.ts +4 -4
  134. package/lib/Form/Label.js +41 -21
  135. package/lib/Form/config.d.ts +100 -22
  136. package/lib/Form/config.js +21 -21
  137. package/lib/Form/hooks/index.d.ts +12 -5
  138. package/lib/Form/hooks/index.js +66 -50
  139. package/lib/Form/hooks/useHForm.js +235 -97
  140. package/lib/Form/hooks/useInitConfigData.d.ts +4 -1
  141. package/lib/Form/hooks/useInitConfigData.js +144 -63
  142. package/lib/Form/index.d.ts +11 -1
  143. package/lib/Form/index.js +73 -42
  144. package/lib/Form/modal.d.ts +92 -51
  145. package/lib/Input/ButtonInput.js +75 -53
  146. package/lib/Input/InputNumber.js +23 -14
  147. package/lib/Input/SelectInput.d.ts +16 -4
  148. package/lib/Input/SelectInput.js +125 -60
  149. package/lib/Input/defaultConfig.d.ts +3 -3
  150. package/lib/Input/defaultConfig.js +3 -3
  151. package/lib/Input/index.js +9 -9
  152. package/lib/Input/modal.d.ts +15 -11
  153. package/lib/PageHandler/ErrorComponent.js +49 -27
  154. package/lib/PageHandler/LoadingComponent.js +19 -15
  155. package/lib/PageHandler/index.js +9 -9
  156. package/lib/PageHandler/modal.d.ts +4 -4
  157. package/lib/RadioGroup/index.d.ts +12 -5
  158. package/lib/RadioGroup/index.js +48 -35
  159. package/lib/Select/components/AllSelect.d.ts +1 -1
  160. package/lib/Select/components/AllSelect.js +42 -20
  161. package/lib/Select/components/CheckBoxOption.d.ts +6 -3
  162. package/lib/Select/components/CheckBoxOption.js +14 -9
  163. package/lib/Select/components/DropdownComponent.d.ts +4 -4
  164. package/lib/Select/components/DropdownComponent.js +32 -19
  165. package/lib/Select/components/NoFindItem.d.ts +1 -1
  166. package/lib/Select/components/NoFindItem.js +13 -9
  167. package/lib/Select/components/NotFoundContent.d.ts +2 -2
  168. package/lib/Select/components/NotFoundContent.js +51 -29
  169. package/lib/Select/defaultConfig.d.ts +1 -1
  170. package/lib/Select/defaultConfig.js +21 -17
  171. package/lib/Select/hooks/changeHooks.d.ts +2 -2
  172. package/lib/Select/hooks/changeHooks.js +148 -72
  173. package/lib/Select/hooks/norHooks.d.ts +27 -9
  174. package/lib/Select/hooks/norHooks.js +52 -40
  175. package/lib/Select/index.d.ts +22 -1
  176. package/lib/Select/index.js +128 -67
  177. package/lib/Select/modal.d.ts +15 -15
  178. package/lib/Select/utils.js +61 -16
  179. package/lib/Submit/index.d.ts +9 -3
  180. package/lib/Submit/index.js +20 -15
  181. package/lib/Switch/index.d.ts +4 -4
  182. package/lib/Switch/index.js +48 -22
  183. package/lib/TDPicker/RangePicker.d.ts +8 -3
  184. package/lib/TDPicker/RangePicker.js +136 -64
  185. package/lib/TDPicker/TimePicker.d.ts +6 -1
  186. package/lib/TDPicker/TimePicker.js +21 -15
  187. package/lib/TDPicker/hooks.d.ts +42 -22
  188. package/lib/TDPicker/hooks.js +98 -72
  189. package/lib/TDPicker/index.d.ts +7 -1
  190. package/lib/TDPicker/index.js +22 -16
  191. package/lib/TDPicker/modal.d.ts +21 -16
  192. package/lib/Upload/Btn.d.ts +5 -1
  193. package/lib/Upload/Btn.js +37 -21
  194. package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
  195. package/lib/Upload/MediaTypeEle/TypeEle.js +33 -25
  196. package/lib/Upload/MediaTypeEle/index.d.ts +5 -1
  197. package/lib/Upload/MediaTypeEle/index.js +23 -20
  198. package/lib/Upload/Preview/index.d.ts +5 -1
  199. package/lib/Upload/Preview/index.js +19 -15
  200. package/lib/Upload/UrlUpload/index.d.ts +7 -1
  201. package/lib/Upload/UrlUpload/index.js +74 -53
  202. package/lib/Upload/enums.d.ts +3 -3
  203. package/lib/Upload/enums.js +4 -4
  204. package/lib/Upload/hooks/change.d.ts +8 -1
  205. package/lib/Upload/hooks/change.js +116 -59
  206. package/lib/Upload/hooks/customRequest.d.ts +5 -1
  207. package/lib/Upload/hooks/customRequest.js +64 -47
  208. package/lib/Upload/hooks/propsMaker.d.ts +5 -1
  209. package/lib/Upload/hooks/propsMaker.js +55 -15
  210. package/lib/Upload/index.d.ts +3 -1
  211. package/lib/Upload/index.js +133 -63
  212. package/lib/Upload/modal.d.ts +17 -15
  213. package/lib/Upload/util.d.ts +8 -2
  214. package/lib/Upload/util.js +16 -8
  215. package/lib/config.js +35 -32
  216. package/lib/hooks/index.d.ts +14 -7
  217. package/lib/hooks/index.js +125 -50
  218. package/lib/index.d.ts +98 -16
  219. package/lib/index.js +5 -5
  220. package/lib/modal.d.ts +6 -6
  221. package/package.json +2 -2
  222. package/src/components/CheckboxGroup/index.tsx +2 -2
  223. package/src/components/Form/FormItem/Helper.tsx +3 -4
  224. package/src/components/Form/HFormConnect.tsx +6 -2
  225. package/src/components/Form/hooks/useHForm.ts +59 -10
  226. package/src/components/Form/modal.ts +12 -8
  227. package/src/components/TDPicker/RangePicker.tsx +7 -5
  228. package/src/components/TDPicker/modal.ts +1 -0
  229. package/src/pages/Form/index.tsx +2 -2
@@ -1,26 +1,75 @@
1
1
  // welcome to hoo hoo hoo
2
- import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
3
- import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
4
- import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
5
- import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
6
- import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
7
- import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
8
- import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
9
- import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
10
- import _extends from '@babel/runtime-corejs3/helpers/extends';
11
- import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
12
- import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
13
- import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
14
- import { Upload } from 'antd';
15
- import Btn from './Btn.js';
16
- import React, { useState, useImperativeHandle, useMemo } from 'react';
17
- import Preview from './Preview/index.js';
18
- import { useChange } from './hooks/change.js';
19
- import { useProps } from './hooks/propsMaker.js';
2
+ import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
3
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js/object/get-own-property-symbols";
4
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
5
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
6
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
7
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptors";
8
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js/object/define-properties";
9
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
10
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
11
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
12
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
13
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
14
+ import { Upload } from "antd";
15
+ import Btn from "./Btn.js";
16
+ import React, { useState, useImperativeHandle, useMemo } from "react";
17
+ import Preview from "./Preview/index.js";
18
+ import { useChange } from "./hooks/change.js";
19
+ import { useProps } from "./hooks/propsMaker.js";
20
20
 
21
- var _excluded = ["value", "onChange", "listType", "exFiles", "maxCount", "maxRowNum", "onPreview", "request", "maxSize"];
22
- 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; }
23
- 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; }
21
+ var _excluded = [
22
+ "value",
23
+ "onChange",
24
+ "listType",
25
+ "exFiles",
26
+ "maxCount",
27
+ "maxRowNum",
28
+ "onPreview",
29
+ "request",
30
+ "maxSize",
31
+ ];
32
+ function ownKeys(object, enumerableOnly) {
33
+ var keys = _Object$keys(object);
34
+ if (_Object$getOwnPropertySymbols) {
35
+ var symbols = _Object$getOwnPropertySymbols(object);
36
+ enumerableOnly &&
37
+ (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
38
+ return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
39
+ })),
40
+ keys.push.apply(keys, symbols);
41
+ }
42
+ return keys;
43
+ }
44
+ function _objectSpread(target) {
45
+ for (var i = 1; i < arguments.length; i++) {
46
+ var _context, _context2;
47
+ var source = null != arguments[i] ? arguments[i] : {};
48
+ i % 2
49
+ ? _forEachInstanceProperty((_context = ownKeys(Object(source), !0))).call(
50
+ _context,
51
+ function (key) {
52
+ _defineProperty(target, key, source[key]);
53
+ }
54
+ )
55
+ : _Object$getOwnPropertyDescriptors
56
+ ? _Object$defineProperties(
57
+ target,
58
+ _Object$getOwnPropertyDescriptors(source)
59
+ )
60
+ : _forEachInstanceProperty((_context2 = ownKeys(Object(source)))).call(
61
+ _context2,
62
+ function (key) {
63
+ _Object$defineProperty(
64
+ target,
65
+ key,
66
+ _Object$getOwnPropertyDescriptor(source, key)
67
+ );
68
+ }
69
+ );
70
+ }
71
+ return target;
72
+ }
24
73
  var Index = function Index(_ref, ref) {
25
74
  var _ref$value = _ref.value,
26
75
  value = _ref$value === void 0 ? [] : _ref$value,
@@ -39,31 +88,40 @@ var Index = function Index(_ref, ref) {
39
88
  var matchProps = useProps({
40
89
  request: request,
41
90
  exFiles: exFiles,
42
- maxSize: maxSize
91
+ maxSize: maxSize,
43
92
  });
44
93
  var _useState = useState({}),
45
94
  _useState2 = _slicedToArray(_useState, 2),
46
95
  previewModal = _useState2[0],
47
96
  setPreviewModal = _useState2[1];
48
- var change = useChange(_objectSpread(_objectSpread({}, matchProps), {}, {
49
- value: value,
50
- maxCount: maxCount,
51
- onChange: onChange
52
- }));
97
+ var change = useChange(
98
+ _objectSpread(
99
+ _objectSpread({}, matchProps),
100
+ {},
101
+ {
102
+ value: value,
103
+ maxCount: maxCount,
104
+ onChange: onChange,
105
+ }
106
+ )
107
+ );
53
108
  useImperativeHandle(ref, function () {
54
109
  return {
55
- change: change
110
+ change: change,
56
111
  };
57
112
  });
58
- var contentStyle = useMemo(function () {
59
- if (listType !== "picture-card") {
60
- return {};
61
- }
62
- return {
63
- width: 112 * maxRowNum,
64
- maxWidth: "100%"
65
- };
66
- }, [maxRowNum, listType]);
113
+ var contentStyle = useMemo(
114
+ function () {
115
+ if (listType !== "picture-card") {
116
+ return {};
117
+ }
118
+ return {
119
+ width: 112 * maxRowNum,
120
+ maxWidth: "100%",
121
+ };
122
+ },
123
+ [maxRowNum, listType]
124
+ );
67
125
  var preview = function preview(file) {
68
126
  if (onPreview) {
69
127
  onPreview(file);
@@ -71,36 +129,48 @@ var Index = function Index(_ref, ref) {
71
129
  }
72
130
  setPreviewModal({
73
131
  visible: true,
74
- file: file
132
+ file: file,
75
133
  });
76
134
  };
77
135
  var maxNum = maxCount === 1 ? maxCount : Number.MAX_VALUE;
78
136
  var visible = previewModal.visible,
79
137
  previewFile = previewModal.file;
80
- return /*#__PURE__*/React.createElement("div", {
81
- style: contentStyle
82
- }, /*#__PURE__*/React.createElement(Upload, _extends({
83
- listType: listType,
84
- maxCount: maxNum,
85
- fileList: value,
86
- onPreview: preview,
87
- onChange: change,
88
- beforeUpload: function beforeUpload() {
89
- return false;
90
- }
91
- }, props), /*#__PURE__*/React.createElement(Btn, {
92
- value: value,
93
- maxCount: maxCount,
94
- listType: listType
95
- })), /*#__PURE__*/React.createElement(Preview, {
96
- visible: visible,
97
- file: previewFile,
98
- onCancel: function onCancel() {
99
- setPreviewModal({});
100
- }
101
- }));
138
+ return /*#__PURE__*/ React.createElement(
139
+ "div",
140
+ {
141
+ style: contentStyle,
142
+ },
143
+ /*#__PURE__*/ React.createElement(
144
+ Upload,
145
+ _extends(
146
+ {
147
+ listType: listType,
148
+ maxCount: maxNum,
149
+ fileList: value,
150
+ onPreview: preview,
151
+ onChange: change,
152
+ beforeUpload: function beforeUpload() {
153
+ return false;
154
+ },
155
+ },
156
+ props
157
+ ),
158
+ /*#__PURE__*/ React.createElement(Btn, {
159
+ value: value,
160
+ maxCount: maxCount,
161
+ listType: listType,
162
+ })
163
+ ),
164
+ /*#__PURE__*/ React.createElement(Preview, {
165
+ visible: visible,
166
+ file: previewFile,
167
+ onCancel: function onCancel() {
168
+ setPreviewModal({});
169
+ },
170
+ })
171
+ );
102
172
  };
103
- var HUpload = /*#__PURE__*/React.forwardRef(Index);
173
+ var HUpload = /*#__PURE__*/ React.forwardRef(Index);
104
174
 
105
175
  export { HUpload as default };
106
176
  // powered by hdj
@@ -4,25 +4,27 @@ 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
- 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;
7
+ exFiles?: string[];
8
+ request?: (
9
+ file: Exclude<BeforeUploadFileType, File | boolean> | RcFile
10
+ ) => Promise<{
11
+ url: string;
12
+ }>;
13
+ errorType?: "alert" | "show";
14
+ onChange?: (fileList: UploadFile[]) => void;
15
+ value?: UploadFile[];
16
+ maxRowNum?: number;
17
+ maxSize?: number;
16
18
  }
17
19
  export interface IMediaTypeEleProps {
18
- file?: UploadFile;
19
- onReady?: VoidFunction;
20
- onError?: VoidFunction;
20
+ file?: UploadFile;
21
+ onReady?: VoidFunction;
22
+ onError?: VoidFunction;
21
23
  }
22
24
  export interface IUploadRefModal {
23
- change: (info: UploadChangeParam<UploadFile>) => void;
25
+ change: (info: UploadChangeParam<UploadFile>) => void;
24
26
  }
25
27
  export interface IUrlUploadProps extends IUpLoadProps {
26
- placeholder?: string;
27
- mediaType?: MediaTypeEnum;
28
+ placeholder?: string;
29
+ mediaType?: MediaTypeEnum;
28
30
  }
@@ -1,5 +1,11 @@
1
1
  import type { UploadFile } from "antd/es/upload/interface";
2
2
  export declare const getFileExt: (file: UploadFile) => string;
3
- export declare const checkFileType: (file: UploadFile, exFiles?: string[]) => boolean;
4
- export declare const checkFileSize: (file: UploadFile, maxSize?: number) => boolean;
3
+ export declare const checkFileType: (
4
+ file: UploadFile,
5
+ exFiles?: string[]
6
+ ) => boolean;
7
+ export declare const checkFileSize: (
8
+ file: UploadFile,
9
+ maxSize?: number
10
+ ) => boolean;
5
11
  export declare const fileToBase64: (file: any) => Promise<unknown>;
package/es/Upload/util.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // welcome to hoo hoo hoo
2
- import _lastIndexOfInstanceProperty from '@babel/runtime-corejs3/core-js/instance/last-index-of';
3
- import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js/instance/index-of';
4
- import _Promise from '@babel/runtime-corejs3/core-js/promise';
2
+ import _lastIndexOfInstanceProperty from "@babel/runtime-corejs3/core-js/instance/last-index-of";
3
+ import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js/instance/index-of";
4
+ import _Promise from "@babel/runtime-corejs3/core-js/promise";
5
5
 
6
6
  var getFileExt = function getFileExt(file) {
7
7
  var name = file.name;
@@ -9,12 +9,14 @@ var getFileExt = function getFileExt(file) {
9
9
  return name.substring(index + 1).toUpperCase();
10
10
  };
11
11
  var checkFileType = function checkFileType(file) {
12
- var exFiles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
12
+ var exFiles =
13
+ arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
13
14
  var exName = getFileExt(file);
14
15
  return _indexOfInstanceProperty(exFiles).call(exFiles, exName) !== -1;
15
16
  };
16
17
  var checkFileSize = function checkFileSize(file) {
17
- var maxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
18
+ var maxSize =
19
+ arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
18
20
  var _file$size = file.size,
19
21
  size = _file$size === void 0 ? 0 : _file$size;
20
22
  return size <= maxSize;
@@ -22,10 +24,16 @@ var checkFileSize = function checkFileSize(file) {
22
24
  var fileToBase64 = function fileToBase64(file) {
23
25
  return new _Promise(function (resolve) {
24
26
  var reader = new FileReader();
25
- reader.readAsDataURL(file === null || file === void 0 ? void 0 : file.originFileObj);
27
+ reader.readAsDataURL(
28
+ file === null || file === void 0 ? void 0 : file.originFileObj
29
+ );
26
30
  reader.onload = function (e) {
27
31
  var _e$target;
28
- resolve((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result);
32
+ resolve(
33
+ (_e$target = e.target) === null || _e$target === void 0
34
+ ? void 0
35
+ : _e$target.result
36
+ );
29
37
  };
30
38
  });
31
39
  };
package/es/config.js CHANGED
@@ -1,21 +1,21 @@
1
1
  // welcome to hoo hoo hoo
2
- import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
3
- import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
4
- import moment from 'moment';
5
- import { fileToBase64 } from './Upload/util.js';
2
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
4
+ import moment from "moment";
5
+ import { fileToBase64 } from "./Upload/util.js";
6
6
 
7
7
  var baseConfig = {
8
8
  fieldNames: {
9
9
  label: "label",
10
- value: "value"
10
+ value: "value",
11
11
  },
12
12
  valueCheckMap: {
13
13
  checked: true,
14
- noChecked: false
14
+ noChecked: false,
15
15
  },
16
16
  valueSwitchMap: {
17
17
  open: true,
18
- close: false
18
+ close: false,
19
19
  },
20
20
  valueRangePickerValueMap: {
21
21
  start: function start(name) {
@@ -23,41 +23,44 @@ var baseConfig = {
23
23
  },
24
24
  end: function end(name) {
25
25
  return "".concat(name, "EndTime");
26
- }
26
+ },
27
27
  },
28
28
  dateRanges: {
29
29
  最近三天: [moment().subtract(2, "days").startOf("days"), moment()],
30
30
  最近七天: [moment().subtract(6, "days").startOf("days"), moment()],
31
- 最近三十天: [moment().subtract(29, "days").startOf("days"), moment()]
31
+ 最近三十天: [moment().subtract(29, "days").startOf("days"), moment()],
32
32
  },
33
33
  uploadProps: {
34
34
  exFiles: ["JPG", "PNG", "JPEG", "GIF"],
35
- request: function () {
36
- var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
37
- var url;
38
- return _regeneratorRuntime.wrap(function _callee$(_context) {
39
- while (1) switch (_context.prev = _context.next) {
40
- case 0:
41
- _context.next = 2;
42
- return fileToBase64(file);
43
- case 2:
44
- url = _context.sent;
45
- return _context.abrupt("return", {
46
- url: url
47
- });
48
- case 4:
49
- case "end":
50
- return _context.stop();
51
- }
52
- }, _callee);
53
- }));
35
+ request: (function () {
36
+ var _request = _asyncToGenerator(
37
+ /*#__PURE__*/ _regeneratorRuntime.mark(function _callee(file) {
38
+ var url;
39
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
40
+ while (1)
41
+ switch ((_context.prev = _context.next)) {
42
+ case 0:
43
+ _context.next = 2;
44
+ return fileToBase64(file);
45
+ case 2:
46
+ url = _context.sent;
47
+ return _context.abrupt("return", {
48
+ url: url,
49
+ });
50
+ case 4:
51
+ case "end":
52
+ return _context.stop();
53
+ }
54
+ }, _callee);
55
+ })
56
+ );
54
57
  function request(_x) {
55
58
  return _request.apply(this, arguments);
56
59
  }
57
60
  return request;
58
- }(),
59
- maxSize: 1024 * 1024 * 1.8
60
- }
61
+ })(),
62
+ maxSize: 1024 * 1024 * 1.8,
63
+ },
61
64
  };
62
65
 
63
66
  export { baseConfig };
@@ -1,13 +1,20 @@
1
1
  import type { SelectProps } from "antd";
2
2
  import type { IFormConfigContextProps } from "../Form/modal";
3
3
  interface UseChangeOptionsParams {
4
- options?: Record<string, any>[];
5
- fieldNames?: SelectProps["fieldNames"];
4
+ options?: Record<string, any>[];
5
+ fieldNames?: SelectProps["fieldNames"];
6
6
  }
7
- export declare const useChangeOptions: ({ options, fieldNames, }: UseChangeOptionsParams) => {
8
- label: any;
9
- value: any;
10
- }[] | undefined;
7
+ export declare const useChangeOptions: ({
8
+ options,
9
+ fieldNames,
10
+ }: UseChangeOptionsParams) =>
11
+ | {
12
+ label: any;
13
+ value: any;
14
+ }[]
15
+ | undefined;
11
16
  export declare const useClassName: (className: string | string[]) => string;
12
- export declare const useMatchConfigProps: (matchProps: IFormConfigContextProps) => IFormConfigContextProps;
17
+ export declare const useMatchConfigProps: (
18
+ matchProps: IFormConfigContextProps
19
+ ) => IFormConfigContextProps;
13
20
  export {};
package/es/hooks/index.js CHANGED
@@ -1,61 +1,136 @@
1
1
  // welcome to hoo hoo hoo
2
- import _typeof from '@babel/runtime-corejs3/helpers/typeof';
3
- import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
4
- import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
- import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
6
- import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
7
- import _concatInstanceProperty from '@babel/runtime-corejs3/core-js/instance/concat';
8
- import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
9
- import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
10
- import _Symbol$toPrimitive from '@babel/runtime-corejs3/core-js/symbol/to-primitive';
11
- import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
12
- import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
13
- import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
14
- import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
15
- import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
16
- import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
17
- import { useMemo, useContext } from 'react';
18
- import { ConfigContext } from 'antd/es/config-provider';
19
- import { useFormConfigContext } from '../Form/Context/FormConfigProvider.js';
2
+ import _typeof from "@babel/runtime-corejs3/helpers/typeof";
3
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
5
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
6
+ import _Array$isArray from "@babel/runtime-corejs3/core-js/array/is-array";
7
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
8
+ import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
9
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
10
+ import _Symbol$toPrimitive from "@babel/runtime-corejs3/core-js/symbol/to-primitive";
11
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js/object/get-own-property-symbols";
12
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
13
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
14
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptors";
15
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js/object/define-properties";
16
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
17
+ import { useMemo, useContext } from "react";
18
+ import { ConfigContext } from "antd/es/config-provider";
19
+ import { useFormConfigContext } from "../Form/Context/FormConfigProvider.js";
20
20
 
21
- 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; }
22
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
23
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
24
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[_Symbol$toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
21
+ function ownKeys(object, enumerableOnly) {
22
+ var keys = _Object$keys(object);
23
+ if (_Object$getOwnPropertySymbols) {
24
+ var symbols = _Object$getOwnPropertySymbols(object);
25
+ enumerableOnly &&
26
+ (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
27
+ return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
28
+ })),
29
+ keys.push.apply(keys, symbols);
30
+ }
31
+ return keys;
32
+ }
33
+ function _objectSpread(target) {
34
+ for (var i = 1; i < arguments.length; i++) {
35
+ var _context4, _context5;
36
+ var source = null != arguments[i] ? arguments[i] : {};
37
+ i % 2
38
+ ? _forEachInstanceProperty(
39
+ (_context4 = ownKeys(Object(source), !0))
40
+ ).call(_context4, function (key) {
41
+ _defineProperty(target, key, source[key]);
42
+ })
43
+ : _Object$getOwnPropertyDescriptors
44
+ ? _Object$defineProperties(
45
+ target,
46
+ _Object$getOwnPropertyDescriptors(source)
47
+ )
48
+ : _forEachInstanceProperty((_context5 = ownKeys(Object(source)))).call(
49
+ _context5,
50
+ function (key) {
51
+ _Object$defineProperty(
52
+ target,
53
+ key,
54
+ _Object$getOwnPropertyDescriptor(source, key)
55
+ );
56
+ }
57
+ );
58
+ }
59
+ return target;
60
+ }
61
+ function _toPropertyKey(arg) {
62
+ var key = _toPrimitive(arg, "string");
63
+ return _typeof(key) === "symbol" ? key : String(key);
64
+ }
65
+ function _toPrimitive(input, hint) {
66
+ if (_typeof(input) !== "object" || input === null) return input;
67
+ var prim = input[_Symbol$toPrimitive];
68
+ if (prim !== undefined) {
69
+ var res = prim.call(input, hint || "default");
70
+ if (_typeof(res) !== "object") return res;
71
+ throw new TypeError("@@toPrimitive must return a primitive value.");
72
+ }
73
+ return (hint === "string" ? String : Number)(input);
74
+ }
25
75
  var useChangeOptions = function useChangeOptions(_ref) {
26
76
  var options = _ref.options,
27
77
  _ref$fieldNames = _ref.fieldNames,
28
78
  fieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames;
29
- return useMemo(function () {
30
- return options === null || options === void 0 ? void 0 : _mapInstanceProperty(options).call(options, function (item) {
31
- var _context;
32
- var _fieldNames$label = fieldNames.label,
33
- label = _fieldNames$label === void 0 ? "" : _fieldNames$label,
34
- _fieldNames$value = fieldNames.value,
35
- value = _fieldNames$value === void 0 ? "" : _fieldNames$value;
36
- var relLabel = item[label],
37
- relVal = item[value],
38
- oItem = _objectWithoutProperties(item, _mapInstanceProperty(_context = [label, value]).call(_context, _toPropertyKey));
39
- return _objectSpread(_objectSpread({}, oItem), {}, {
40
- label: relLabel,
41
- value: relVal
42
- });
43
- });
44
- }, [options]);
79
+ return useMemo(
80
+ function () {
81
+ return options === null || options === void 0
82
+ ? void 0
83
+ : _mapInstanceProperty(options).call(options, function (item) {
84
+ var _context;
85
+ var _fieldNames$label = fieldNames.label,
86
+ label = _fieldNames$label === void 0 ? "" : _fieldNames$label,
87
+ _fieldNames$value = fieldNames.value,
88
+ value = _fieldNames$value === void 0 ? "" : _fieldNames$value;
89
+ var relLabel = item[label],
90
+ relVal = item[value],
91
+ oItem = _objectWithoutProperties(
92
+ item,
93
+ _mapInstanceProperty((_context = [label, value])).call(
94
+ _context,
95
+ _toPropertyKey
96
+ )
97
+ );
98
+ return _objectSpread(
99
+ _objectSpread({}, oItem),
100
+ {},
101
+ {
102
+ label: relLabel,
103
+ value: relVal,
104
+ }
105
+ );
106
+ });
107
+ },
108
+ [options]
109
+ );
45
110
  };
46
111
  var useClassName = function useClassName(className) {
47
112
  var config = useContext(ConfigContext);
48
- return useMemo(function () {
49
- var _context3;
50
- if (_Array$isArray(className)) {
51
- var classNames = _mapInstanceProperty(className).call(className, function (item) {
52
- var _context2;
53
- return _concatInstanceProperty(_context2 = "".concat(config.getPrefixCls(), "-")).call(_context2, item);
54
- });
55
- return classNames.join(" ");
56
- }
57
- return _concatInstanceProperty(_context3 = "".concat(config.getPrefixCls(), "-")).call(_context3, className);
58
- }, [className]);
113
+ return useMemo(
114
+ function () {
115
+ var _context3;
116
+ if (_Array$isArray(className)) {
117
+ var classNames = _mapInstanceProperty(className).call(
118
+ className,
119
+ function (item) {
120
+ var _context2;
121
+ return _concatInstanceProperty(
122
+ (_context2 = "".concat(config.getPrefixCls(), "-"))
123
+ ).call(_context2, item);
124
+ }
125
+ );
126
+ return classNames.join(" ");
127
+ }
128
+ return _concatInstanceProperty(
129
+ (_context3 = "".concat(config.getPrefixCls(), "-"))
130
+ ).call(_context3, className);
131
+ },
132
+ [className]
133
+ );
59
134
  };
60
135
  var useMatchConfigProps = function useMatchConfigProps(matchProps) {
61
136
  var globalConfig = useFormConfigContext();