@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.
Files changed (246) hide show
  1. package/es/CheckboxGroup/CheckBox/index.js +16 -24
  2. package/es/CheckboxGroup/hooks.d.ts +3 -9
  3. package/es/CheckboxGroup/hooks.js +64 -115
  4. package/es/CheckboxGroup/index.d.ts +1 -6
  5. package/es/CheckboxGroup/index.js +58 -117
  6. package/es/CheckboxGroup/modal.d.ts +8 -9
  7. package/es/Form/Context/FormConfigProvider.js +19 -64
  8. package/es/Form/Context/index.d.ts +1 -4
  9. package/es/Form/Context/index.js +3 -3
  10. package/es/Form/FormItem/BasicItem.js +42 -80
  11. package/es/Form/FormItem/Helper.d.ts +1 -1
  12. package/es/Form/FormItem/Helper.js +9 -17
  13. package/es/Form/FormItem/RegularFormItem.js +8 -11
  14. package/es/Form/FormItem/UpFormItem.d.ts +1 -6
  15. package/es/Form/FormItem/UpFormItem.js +17 -27
  16. package/es/Form/FormItem/hooks.d.ts +4 -21
  17. package/es/Form/FormItem/hooks.js +9 -12
  18. package/es/Form/FormItem/index.js +5 -5
  19. package/es/Form/HFormConnect.d.ts +1 -9
  20. package/es/Form/HFormConnect.js +30 -90
  21. package/es/Form/InitSet.d.ts +1 -4
  22. package/es/Form/InitSet.js +6 -7
  23. package/es/Form/Label.d.ts +4 -4
  24. package/es/Form/Label.js +19 -36
  25. package/es/Form/config.d.ts +22 -100
  26. package/es/Form/config.js +19 -19
  27. package/es/Form/hooks/index.d.ts +1 -14
  28. package/es/Form/hooks/index.js +32 -80
  29. package/es/Form/hooks/useHForm.js +143 -224
  30. package/es/Form/hooks/useInitConfigData.d.ts +1 -4
  31. package/es/Form/hooks/useInitConfigData.js +61 -143
  32. package/es/Form/index.d.ts +1 -11
  33. package/es/Form/index.js +79 -79
  34. package/es/Form/modal.d.ts +54 -89
  35. package/es/Input/ButtonInput.js +51 -73
  36. package/es/Input/InputNumber.js +12 -21
  37. package/es/Input/SelectInput.d.ts +4 -16
  38. package/es/Input/SelectInput.js +62 -116
  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 +13 -15
  43. package/es/ModalForm/hooks.d.ts +12 -0
  44. package/es/ModalForm/hooks.js +78 -0
  45. package/es/ModalForm/index.d.ts +4 -0
  46. package/es/ModalForm/index.js +59 -0
  47. package/es/ModalForm/modal.d.ts +23 -0
  48. package/es/PageHandler/ErrorComponent.js +25 -47
  49. package/es/PageHandler/LoadingComponent.js +13 -17
  50. package/es/PageHandler/index.js +7 -7
  51. package/es/PageHandler/modal.d.ts +4 -4
  52. package/es/RadioGroup/index.d.ts +5 -12
  53. package/es/RadioGroup/index.js +33 -46
  54. package/es/Select/components/AllSelect.d.ts +1 -1
  55. package/es/Select/components/AllSelect.js +18 -40
  56. package/es/Select/components/CheckBoxOption.d.ts +3 -6
  57. package/es/Select/components/CheckBoxOption.js +7 -12
  58. package/es/Select/components/DropdownComponent.d.ts +4 -4
  59. package/es/Select/components/DropdownComponent.js +17 -30
  60. package/es/Select/components/NoFindItem.d.ts +1 -1
  61. package/es/Select/components/NoFindItem.js +7 -11
  62. package/es/Select/components/NotFoundContent.d.ts +2 -2
  63. package/es/Select/components/NotFoundContent.js +27 -49
  64. package/es/Select/defaultConfig.d.ts +1 -1
  65. package/es/Select/defaultConfig.js +16 -20
  66. package/es/Select/hooks/changeHooks.d.ts +2 -2
  67. package/es/Select/hooks/changeHooks.js +71 -147
  68. package/es/Select/hooks/norHooks.d.ts +9 -27
  69. package/es/Select/hooks/norHooks.js +39 -51
  70. package/es/Select/index.d.ts +1 -22
  71. package/es/Select/index.js +65 -124
  72. package/es/Select/modal.d.ts +15 -15
  73. package/es/Select/utils.js +15 -60
  74. package/es/Submit/index.d.ts +3 -9
  75. package/es/Submit/index.js +13 -18
  76. package/es/Switch/index.d.ts +4 -4
  77. package/es/Switch/index.js +20 -46
  78. package/es/TDPicker/RangePicker.d.ts +3 -8
  79. package/es/TDPicker/RangePicker.js +67 -138
  80. package/es/TDPicker/TimePicker.d.ts +1 -6
  81. package/es/TDPicker/TimePicker.js +13 -19
  82. package/es/TDPicker/hooks.d.ts +22 -42
  83. package/es/TDPicker/hooks.js +72 -106
  84. package/es/TDPicker/index.d.ts +1 -7
  85. package/es/TDPicker/index.js +14 -20
  86. package/es/TDPicker/modal.d.ts +16 -21
  87. package/es/TextArea/index.d.ts +1 -0
  88. package/es/Upload/Btn.d.ts +1 -5
  89. package/es/Upload/Btn.js +19 -35
  90. package/es/Upload/MediaTypeEle/TypeEle.d.ts +5 -10
  91. package/es/Upload/MediaTypeEle/TypeEle.js +23 -31
  92. package/es/Upload/MediaTypeEle/index.d.ts +1 -5
  93. package/es/Upload/MediaTypeEle/index.js +18 -21
  94. package/es/Upload/Preview/index.d.ts +1 -5
  95. package/es/Upload/Preview/index.js +13 -17
  96. package/es/Upload/UrlUpload/index.d.ts +1 -7
  97. package/es/Upload/UrlUpload/index.js +51 -72
  98. package/es/Upload/enums.d.ts +3 -3
  99. package/es/Upload/enums.js +3 -3
  100. package/es/Upload/hooks/change.d.ts +1 -8
  101. package/es/Upload/hooks/change.js +58 -115
  102. package/es/Upload/hooks/customRequest.d.ts +1 -5
  103. package/es/Upload/hooks/customRequest.js +46 -63
  104. package/es/Upload/hooks/propsMaker.d.ts +1 -5
  105. package/es/Upload/hooks/propsMaker.js +13 -52
  106. package/es/Upload/index.d.ts +1 -3
  107. package/es/Upload/index.js +61 -131
  108. package/es/Upload/modal.d.ts +15 -17
  109. package/es/Upload/util.d.ts +2 -8
  110. package/es/Upload/util.js +7 -15
  111. package/es/config.js +31 -34
  112. package/es/hooks/index.d.ts +7 -14
  113. package/es/hooks/index.js +49 -124
  114. package/es/index.d.ts +18 -98
  115. package/es/index.js +8 -22
  116. package/es/modal.d.ts +6 -6
  117. package/lib/CheckboxGroup/CheckBox/index.js +18 -26
  118. package/lib/CheckboxGroup/hooks.d.ts +3 -9
  119. package/lib/CheckboxGroup/hooks.js +65 -116
  120. package/lib/CheckboxGroup/index.d.ts +1 -6
  121. package/lib/CheckboxGroup/index.js +60 -119
  122. package/lib/CheckboxGroup/modal.d.ts +8 -9
  123. package/lib/Form/Context/FormConfigProvider.js +21 -66
  124. package/lib/Form/Context/index.d.ts +1 -4
  125. package/lib/Form/Context/index.js +4 -4
  126. package/lib/Form/FormItem/BasicItem.js +44 -82
  127. package/lib/Form/FormItem/Helper.d.ts +1 -1
  128. package/lib/Form/FormItem/Helper.js +11 -19
  129. package/lib/Form/FormItem/RegularFormItem.js +10 -13
  130. package/lib/Form/FormItem/UpFormItem.d.ts +1 -6
  131. package/lib/Form/FormItem/UpFormItem.js +19 -29
  132. package/lib/Form/FormItem/hooks.d.ts +4 -21
  133. package/lib/Form/FormItem/hooks.js +10 -13
  134. package/lib/Form/FormItem/index.js +7 -7
  135. package/lib/Form/HFormConnect.d.ts +1 -9
  136. package/lib/Form/HFormConnect.js +32 -92
  137. package/lib/Form/InitSet.d.ts +1 -4
  138. package/lib/Form/InitSet.js +8 -9
  139. package/lib/Form/Label.d.ts +4 -4
  140. package/lib/Form/Label.js +21 -41
  141. package/lib/Form/config.d.ts +22 -100
  142. package/lib/Form/config.js +21 -21
  143. package/lib/Form/hooks/index.d.ts +1 -14
  144. package/lib/Form/hooks/index.js +32 -81
  145. package/lib/Form/hooks/useHForm.js +145 -226
  146. package/lib/Form/hooks/useInitConfigData.d.ts +1 -4
  147. package/lib/Form/hooks/useInitConfigData.js +63 -144
  148. package/lib/Form/index.d.ts +1 -11
  149. package/lib/Form/index.js +83 -83
  150. package/lib/Form/modal.d.ts +54 -89
  151. package/lib/Input/ButtonInput.js +53 -75
  152. package/lib/Input/InputNumber.js +14 -23
  153. package/lib/Input/SelectInput.d.ts +4 -16
  154. package/lib/Input/SelectInput.js +66 -128
  155. package/lib/Input/defaultConfig.d.ts +3 -3
  156. package/lib/Input/defaultConfig.js +3 -3
  157. package/lib/Input/index.js +9 -9
  158. package/lib/Input/modal.d.ts +13 -15
  159. package/lib/ModalForm/hooks.d.ts +12 -0
  160. package/lib/ModalForm/hooks.js +81 -0
  161. package/lib/ModalForm/index.d.ts +4 -0
  162. package/lib/ModalForm/index.js +62 -0
  163. package/lib/ModalForm/modal.d.ts +23 -0
  164. package/lib/PageHandler/ErrorComponent.js +27 -49
  165. package/lib/PageHandler/LoadingComponent.js +15 -19
  166. package/lib/PageHandler/index.js +9 -9
  167. package/lib/PageHandler/modal.d.ts +4 -4
  168. package/lib/RadioGroup/index.d.ts +5 -12
  169. package/lib/RadioGroup/index.js +35 -48
  170. package/lib/Select/components/AllSelect.d.ts +1 -1
  171. package/lib/Select/components/AllSelect.js +20 -42
  172. package/lib/Select/components/CheckBoxOption.d.ts +3 -6
  173. package/lib/Select/components/CheckBoxOption.js +9 -14
  174. package/lib/Select/components/DropdownComponent.d.ts +4 -4
  175. package/lib/Select/components/DropdownComponent.js +19 -32
  176. package/lib/Select/components/NoFindItem.d.ts +1 -1
  177. package/lib/Select/components/NoFindItem.js +9 -13
  178. package/lib/Select/components/NotFoundContent.d.ts +2 -2
  179. package/lib/Select/components/NotFoundContent.js +29 -51
  180. package/lib/Select/defaultConfig.d.ts +1 -1
  181. package/lib/Select/defaultConfig.js +17 -21
  182. package/lib/Select/hooks/changeHooks.d.ts +2 -2
  183. package/lib/Select/hooks/changeHooks.js +72 -148
  184. package/lib/Select/hooks/norHooks.d.ts +9 -27
  185. package/lib/Select/hooks/norHooks.js +40 -52
  186. package/lib/Select/index.d.ts +1 -22
  187. package/lib/Select/index.js +67 -128
  188. package/lib/Select/modal.d.ts +15 -15
  189. package/lib/Select/utils.js +16 -61
  190. package/lib/Submit/index.d.ts +3 -9
  191. package/lib/Submit/index.js +15 -20
  192. package/lib/Switch/index.d.ts +4 -4
  193. package/lib/Switch/index.js +22 -48
  194. package/lib/TDPicker/RangePicker.d.ts +3 -8
  195. package/lib/TDPicker/RangePicker.js +69 -136
  196. package/lib/TDPicker/TimePicker.d.ts +1 -6
  197. package/lib/TDPicker/TimePicker.js +15 -21
  198. package/lib/TDPicker/hooks.d.ts +22 -42
  199. package/lib/TDPicker/hooks.js +72 -98
  200. package/lib/TDPicker/index.d.ts +1 -7
  201. package/lib/TDPicker/index.js +16 -22
  202. package/lib/TDPicker/modal.d.ts +16 -21
  203. package/lib/TextArea/index.d.ts +1 -0
  204. package/lib/Upload/Btn.d.ts +1 -5
  205. package/lib/Upload/Btn.js +21 -37
  206. package/lib/Upload/MediaTypeEle/TypeEle.d.ts +5 -10
  207. package/lib/Upload/MediaTypeEle/TypeEle.js +25 -33
  208. package/lib/Upload/MediaTypeEle/index.d.ts +1 -5
  209. package/lib/Upload/MediaTypeEle/index.js +20 -23
  210. package/lib/Upload/Preview/index.d.ts +1 -5
  211. package/lib/Upload/Preview/index.js +15 -19
  212. package/lib/Upload/UrlUpload/index.d.ts +1 -7
  213. package/lib/Upload/UrlUpload/index.js +53 -74
  214. package/lib/Upload/enums.d.ts +3 -3
  215. package/lib/Upload/enums.js +4 -4
  216. package/lib/Upload/hooks/change.d.ts +1 -8
  217. package/lib/Upload/hooks/change.js +59 -116
  218. package/lib/Upload/hooks/customRequest.d.ts +1 -5
  219. package/lib/Upload/hooks/customRequest.js +47 -64
  220. package/lib/Upload/hooks/propsMaker.d.ts +1 -5
  221. package/lib/Upload/hooks/propsMaker.js +15 -55
  222. package/lib/Upload/index.d.ts +1 -3
  223. package/lib/Upload/index.js +63 -133
  224. package/lib/Upload/modal.d.ts +15 -17
  225. package/lib/Upload/util.d.ts +2 -8
  226. package/lib/Upload/util.js +8 -16
  227. package/lib/config.js +32 -35
  228. package/lib/hooks/index.d.ts +7 -14
  229. package/lib/hooks/index.js +50 -125
  230. package/lib/index.d.ts +18 -98
  231. package/lib/index.js +10 -5
  232. package/lib/modal.d.ts +6 -6
  233. package/package.json +1 -1
  234. package/src/components/Form/InitSet.tsx +3 -5
  235. package/src/components/Form/hooks/index.ts +0 -20
  236. package/src/components/Form/hooks/useHForm.ts +8 -4
  237. package/src/components/Form/index.tsx +25 -7
  238. package/src/components/Form/modal.ts +4 -2
  239. package/src/components/Input/SelectInput.tsx +3 -2
  240. package/src/components/Input/modal.ts +2 -0
  241. package/src/components/ModalForm/hooks.ts +61 -0
  242. package/src/components/ModalForm/index.tsx +52 -0
  243. package/src/components/ModalForm/modal.ts +25 -0
  244. package/src/components/index.tsx +4 -0
  245. package/src/pages/ModalForm/index.tsx +127 -0
  246. package/src/routes.tsx +6 -1
@@ -1,75 +1,26 @@
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 = [
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
- }
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; }
73
24
  var Index = function Index(_ref, ref) {
74
25
  var _ref$value = _ref.value,
75
26
  value = _ref$value === void 0 ? [] : _ref$value,
@@ -88,40 +39,31 @@ var Index = function Index(_ref, ref) {
88
39
  var matchProps = useProps({
89
40
  request: request,
90
41
  exFiles: exFiles,
91
- maxSize: maxSize,
42
+ maxSize: maxSize
92
43
  });
93
44
  var _useState = useState({}),
94
45
  _useState2 = _slicedToArray(_useState, 2),
95
46
  previewModal = _useState2[0],
96
47
  setPreviewModal = _useState2[1];
97
- var change = useChange(
98
- _objectSpread(
99
- _objectSpread({}, matchProps),
100
- {},
101
- {
102
- value: value,
103
- maxCount: maxCount,
104
- onChange: onChange,
105
- }
106
- )
107
- );
48
+ var change = useChange(_objectSpread(_objectSpread({}, matchProps), {}, {
49
+ value: value,
50
+ maxCount: maxCount,
51
+ onChange: onChange
52
+ }));
108
53
  useImperativeHandle(ref, function () {
109
54
  return {
110
- change: change,
55
+ change: change
111
56
  };
112
57
  });
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
- );
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]);
125
67
  var preview = function preview(file) {
126
68
  if (onPreview) {
127
69
  onPreview(file);
@@ -129,48 +71,36 @@ var Index = function Index(_ref, ref) {
129
71
  }
130
72
  setPreviewModal({
131
73
  visible: true,
132
- file: file,
74
+ file: file
133
75
  });
134
76
  };
135
77
  var maxNum = maxCount === 1 ? maxCount : Number.MAX_VALUE;
136
78
  var visible = previewModal.visible,
137
79
  previewFile = previewModal.file;
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
- );
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
+ }));
172
102
  };
173
- var HUpload = /*#__PURE__*/ React.forwardRef(Index);
103
+ var HUpload = /*#__PURE__*/React.forwardRef(Index);
174
104
 
175
105
  export { HUpload as default };
176
106
  // powered by hdj
@@ -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
- 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;
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
- file?: UploadFile;
21
- onReady?: VoidFunction;
22
- onError?: VoidFunction;
18
+ file?: UploadFile;
19
+ onReady?: VoidFunction;
20
+ onError?: VoidFunction;
23
21
  }
24
22
  export interface IUploadRefModal {
25
- change: (info: UploadChangeParam<UploadFile>) => void;
23
+ change: (info: UploadChangeParam<UploadFile>) => void;
26
24
  }
27
25
  export interface IUrlUploadProps extends IUpLoadProps {
28
- placeholder?: string;
29
- mediaType?: MediaTypeEnum;
26
+ placeholder?: string;
27
+ mediaType?: MediaTypeEnum;
30
28
  }
@@ -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
- file: UploadFile,
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/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,14 +9,12 @@ 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 =
13
- arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
12
+ var exFiles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
14
13
  var exName = getFileExt(file);
15
14
  return _indexOfInstanceProperty(exFiles).call(exFiles, exName) !== -1;
16
15
  };
17
16
  var checkFileSize = function checkFileSize(file) {
18
- var maxSize =
19
- arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
17
+ var maxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
20
18
  var _file$size = file.size,
21
19
  size = _file$size === void 0 ? 0 : _file$size;
22
20
  return size <= maxSize;
@@ -24,16 +22,10 @@ var checkFileSize = function checkFileSize(file) {
24
22
  var fileToBase64 = function fileToBase64(file) {
25
23
  return new _Promise(function (resolve) {
26
24
  var reader = new FileReader();
27
- reader.readAsDataURL(
28
- file === null || file === void 0 ? void 0 : file.originFileObj
29
- );
25
+ reader.readAsDataURL(file === null || file === void 0 ? void 0 : file.originFileObj);
30
26
  reader.onload = function (e) {
31
27
  var _e$target;
32
- resolve(
33
- (_e$target = e.target) === null || _e$target === void 0
34
- ? void 0
35
- : _e$target.result
36
- );
28
+ resolve((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.result);
37
29
  };
38
30
  });
39
31
  };
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,44 +23,41 @@ 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(
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
- );
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
+ }));
57
54
  function request(_x) {
58
55
  return _request.apply(this, arguments);
59
56
  }
60
57
  return request;
61
- })(),
62
- maxSize: 1024 * 1024 * 1.8,
63
- },
58
+ }(),
59
+ maxSize: 1024 * 1024 * 1.8
60
+ }
64
61
  };
65
62
 
66
63
  export { baseConfig };
@@ -1,20 +1,13 @@
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: ({
8
- options,
9
- fieldNames,
10
- }: UseChangeOptionsParams) =>
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 {};
package/es/hooks/index.js CHANGED
@@ -1,136 +1,61 @@
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) {
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
- }
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); }
75
25
  var useChangeOptions = function useChangeOptions(_ref) {
76
26
  var options = _ref.options,
77
27
  _ref$fieldNames = _ref.fieldNames,
78
28
  fieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames;
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
- );
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]);
110
45
  };
111
46
  var useClassName = function useClassName(className) {
112
47
  var config = useContext(ConfigContext);
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
- );
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]);
134
59
  };
135
60
  var useMatchConfigProps = function useMatchConfigProps(matchProps) {
136
61
  var globalConfig = useFormConfigContext();