@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
package/es/Form/index.js CHANGED
@@ -1,27 +1,21 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from "react";
3
- import _extends from "@babel/runtime-corejs3/helpers/extends";
4
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
5
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
6
- import { Form } from "antd";
7
- import Item from "./FormItem/index.js";
8
- import { useCurrentForm, useSub, useInit } from "./hooks/index.js";
9
- import { FormContext } from "./Context/index.js";
10
- import Index from "../PageHandler/index.js";
11
- import useInitConfigData from "./hooks/useInitConfigData.js";
12
- import InitSet from "./InitSet.js";
2
+ import React, { useEffect } from 'react';
3
+ import _extends from '@babel/runtime-corejs3/helpers/extends';
4
+ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
5
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
6
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
7
+ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
8
+ import { Form } from 'antd';
9
+ import Item from './FormItem/index.js';
10
+ import { useCurrentForm, useSub } from './hooks/index.js';
11
+ import { FormContext } from './Context/index.js';
12
+ import Index from '../PageHandler/index.js';
13
+ import useInitConfigData from './hooks/useInitConfigData.js';
14
+ import { useRequest } from 'ahooks';
15
+ import InitSet from './InitSet.js';
13
16
 
14
- var _excluded = [
15
- "configData",
16
- "labelWidth",
17
- "form",
18
- "request",
19
- "onFinish",
20
- "infoRequest",
21
- "valueType",
22
- "initialValues",
23
- ];
24
- var index = function (_ref) {
17
+ var _excluded = ["configData", "labelWidth", "form", "request", "onFinish", "infoRequest", "valueType", "initialValues"];
18
+ var HForm = (function (_ref) {
25
19
  var configData = _ref.configData,
26
20
  labelWidth = _ref.labelWidth,
27
21
  form = _ref.form,
@@ -35,70 +29,76 @@ var index = function (_ref) {
35
29
  var hForm = useCurrentForm(form);
36
30
  var newConfigData = useInitConfigData({
37
31
  configData: configData,
38
- form: hForm,
32
+ form: hForm
39
33
  });
40
34
  var _useSub = useSub({
41
35
  request: request,
42
36
  onFinish: onFinish,
43
37
  valueType: valueType,
44
- form: hForm,
38
+ form: hForm
45
39
  }),
46
40
  run = _useSub.run,
47
41
  loading = _useSub.loading;
48
- var _useInit = useInit({
49
- infoRequest: infoRequest,
50
- initialValues: initialValues,
51
- }),
52
- infoRun = _useInit.infoRun,
53
- infoLoading = _useInit.infoLoading,
54
- infoErr = _useInit.infoErr,
55
- infoData = _useInit.infoData;
56
- return /*#__PURE__*/ React.createElement(
57
- Index,
58
- {
59
- loading: infoLoading,
60
- error: infoErr,
61
- data: infoData,
62
- reload: infoRun,
63
- },
64
- /*#__PURE__*/ React.createElement(
65
- FormContext.Provider,
66
- {
67
- value: {
68
- loading: loading,
69
- form: hForm,
70
- valueType: valueType,
71
- },
72
- },
73
- /*#__PURE__*/ React.createElement(
74
- Form,
75
- _extends(
76
- {
77
- form: hForm,
78
- onFinish: run,
79
- },
80
- props
81
- ),
82
- _mapInstanceProperty(newConfigData).call(
83
- newConfigData,
84
- function (itemData, index) {
85
- var itemLabelWidth = itemData.labelWidth;
86
- return /*#__PURE__*/ React.createElement(
87
- Item,
88
- _extends({}, itemData, {
89
- key: index,
90
- labelWidth: itemLabelWidth || labelWidth,
91
- })
92
- );
93
- }
94
- )
95
- ),
96
- /*#__PURE__*/ React.createElement(InitSet, {
97
- initValues: infoData,
98
- })
99
- )
100
- );
101
- };
42
+ var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
43
+ var setValue;
44
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
45
+ while (1) switch (_context.prev = _context.next) {
46
+ case 0:
47
+ setValue = initialValues;
48
+ if (!(!initialValues && !infoRequest)) {
49
+ _context.next = 3;
50
+ break;
51
+ }
52
+ return _context.abrupt("return", {});
53
+ case 3:
54
+ if (!infoRequest) {
55
+ _context.next = 7;
56
+ break;
57
+ }
58
+ _context.next = 6;
59
+ return infoRequest();
60
+ case 6:
61
+ setValue = _context.sent;
62
+ case 7:
63
+ hForm.setFieldsValue(setValue);
64
+ return _context.abrupt("return", setValue);
65
+ case 9:
66
+ case "end":
67
+ return _context.stop();
68
+ }
69
+ }, _callee);
70
+ }))),
71
+ infoRun = _useRequest.run,
72
+ infoLoading = _useRequest.loading,
73
+ infoErr = _useRequest.error,
74
+ infoData = _useRequest.data;
75
+ useEffect(function () {
76
+ return function () {
77
+ hForm.removeDispatchListener();
78
+ };
79
+ }, []);
80
+ return /*#__PURE__*/React.createElement(Index, {
81
+ loading: infoLoading,
82
+ error: infoErr,
83
+ data: infoData,
84
+ reload: infoRun
85
+ }, /*#__PURE__*/React.createElement(FormContext.Provider, {
86
+ value: {
87
+ loading: loading,
88
+ form: hForm,
89
+ valueType: valueType
90
+ }
91
+ }, /*#__PURE__*/React.createElement(Form, _extends({
92
+ form: hForm,
93
+ onFinish: run
94
+ }, props), _mapInstanceProperty(newConfigData).call(newConfigData, function (itemData, index) {
95
+ var itemLabelWidth = itemData.labelWidth;
96
+ return /*#__PURE__*/React.createElement(Item, _extends({}, itemData, {
97
+ key: index,
98
+ labelWidth: itemLabelWidth || labelWidth
99
+ }));
100
+ }), /*#__PURE__*/React.createElement(InitSet, null))));
101
+ });
102
102
 
103
- export { index as default };
103
+ export { HForm as default };
104
104
  // powered by hdj
@@ -1,133 +1,98 @@
1
1
  import type { FormInstance, FormItemProps, FormProps } from "antd";
2
2
  import type { HCheckboxProps } from "@/components/CheckboxGroup/modal";
3
3
  import type React from "react";
4
- import type {
5
- HButtonProps,
6
- HInputProps,
7
- HSelectInputProps,
8
- } from "@/components/Input/modal";
4
+ import type { HButtonProps, HInputProps, HSelectInputProps } from "@/components/Input/modal";
9
5
  import type { HRadioGroupProps } from "@/components/RadioGroup";
10
6
  import type { HSelectProps } from "@/components/Select/modal";
11
7
  import type { ButtonProps } from "antd/es";
12
8
  import type { HSwitchProps } from "@/components/Switch";
13
- import type {
14
- HDatePickerProps,
15
- HRangePickerProps,
16
- HTimePickerProps,
17
- } from "@/components/TDPicker/modal";
9
+ import type { HDatePickerProps, HRangePickerProps, HTimePickerProps } from "@/components/TDPicker/modal";
18
10
  import type { TextAreaProps } from "antd/es/input";
19
11
  import type { IUpLoadProps } from "@/components/Upload/modal";
20
12
  import type { SelectProps } from "antd";
21
13
  import type { RangePickerProps } from "antd/es/date-picker";
22
- import type {
23
- PromiseFnResult,
24
- ValueCheckMapModal,
25
- ValueSwitchMapModal,
26
- DateRangePickerValueMapModal,
27
- } from "../modal";
28
- type RenderFun = (
29
- props: HItemProps,
30
- node: React.ReactNode,
31
- form: FormInstance
32
- ) => void;
33
- type ItemPropsType =
34
- | HCheckboxProps
35
- | HInputProps
36
- | HSelectInputProps
37
- | HButtonProps
38
- | HRadioGroupProps
39
- | HSelectProps
40
- | ButtonProps
41
- | HSwitchProps
42
- | HDatePickerProps
43
- | HRangePickerProps
44
- | HTimePickerProps
45
- | TextAreaProps
46
- | IUpLoadProps;
14
+ import type { PromiseFnResult, ValueCheckMapModal, ValueSwitchMapModal, DateRangePickerValueMapModal } from "../modal";
15
+ type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => void;
16
+ type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps;
47
17
  export interface HoverModal {
48
- text?: string;
49
- icon?: React.ReactNode;
18
+ text?: string;
19
+ icon?: React.ReactNode;
50
20
  }
51
21
  type HelperModal = (form: HFormInstance) => React.ReactNode | string;
52
22
  export type HideModal = (form: HFormInstance) => boolean;
23
+ export type AddDispatchListenerFn = (action: ActionModal, fn: argsFn) => void;
53
24
  export interface HItemProps extends Omit<FormItemProps, "name"> {
54
- type?: string;
55
- itemProps?: ItemPropsType;
56
- render?: RenderFun;
57
- helper?: HelperModal | string;
58
- hover?: string | HoverModal;
59
- labelWidth?: number;
60
- hide?: boolean | HideModal;
61
- placeholder?: string | string[];
62
- name?: string;
25
+ type?: string;
26
+ itemProps?: ItemPropsType;
27
+ render?: RenderFun;
28
+ helper?: HelperModal | string;
29
+ hover?: string | HoverModal;
30
+ labelWidth?: number;
31
+ hide?: boolean | HideModal;
32
+ placeholder?: string | string[];
33
+ name?: string;
63
34
  }
64
35
  export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form"> {
65
- configData: HItemProps[];
66
- labelWidth?: number;
67
- request?: PromiseFnResult<T, R>;
68
- infoRequest?: () => Promise<T>;
69
- valueType?: string;
70
- form?: HFormInstance;
36
+ configData: HItemProps[];
37
+ labelWidth?: number;
38
+ request?: PromiseFnResult<T, R>;
39
+ infoRequest?: () => Promise<T>;
40
+ valueType?: string;
41
+ form?: HFormInstance;
71
42
  }
72
43
  export interface HFormItemProps extends HItemProps {
73
- required?: boolean;
44
+ required?: boolean;
74
45
  }
75
46
  export interface FormItemWithRender extends Omit<HFormItemProps, "render"> {
76
- render: (form: HFormInstance) => React.ReactNode;
47
+ render: (form: HFormInstance) => React.ReactNode;
77
48
  }
78
49
  export type argsFn = (...args: any[]) => void;
79
50
  export interface FormContextProps {
80
- loading?: boolean;
81
- form: HFormInstance;
82
- valueType?: string;
51
+ loading?: boolean;
52
+ form: HFormInstance;
53
+ valueType?: string;
83
54
  }
84
55
  interface ConfigUploadProps {
85
- exFiles?: string[];
86
- maxSize?: number;
87
- request?: PromiseFnResult;
56
+ exFiles?: string[];
57
+ maxSize?: number;
58
+ request?: PromiseFnResult;
88
59
  }
89
60
  export interface IFormConfigContextProps {
90
- fieldNames?: SelectProps["fieldNames"];
91
- valueCheckMap?: ValueCheckMapModal;
92
- valueSwitchMap?: ValueSwitchMapModal;
93
- valueRangePickerValueMap?: DateRangePickerValueMapModal;
94
- dateRanges?: RangePickerProps["ranges"];
95
- uploadProps?: ConfigUploadProps;
61
+ fieldNames?: SelectProps["fieldNames"];
62
+ valueCheckMap?: ValueCheckMapModal;
63
+ valueSwitchMap?: ValueSwitchMapModal;
64
+ valueRangePickerValueMap?: DateRangePickerValueMapModal;
65
+ dateRanges?: RangePickerProps["ranges"];
66
+ uploadProps?: ConfigUploadProps;
96
67
  }
97
68
  interface ActionModal {
98
- key: string;
99
- name?: string;
69
+ key: string;
70
+ name?: string;
100
71
  }
101
72
  export interface HFormInstance extends FormInstance {
102
- addFormat: (name: string, formats?: FormatItemModal) => void;
103
- initValues: (values?: Record<string, any>) => void;
104
- formatValues: (
105
- values?: Record<string, any>,
106
- formatKey?: string
107
- ) => Record<string, any>;
108
- dispatch: (action: ActionModal, ...args: any[]) => void;
109
- outputValues: (values?: Record<string, any>) => Record<string, any>;
110
- addDispatchListener: (action: ActionModal, fn: argsFn) => void;
111
- removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
73
+ addFormat: (name: string, formats?: FormatItemModal) => void;
74
+ initValues: VoidFunction;
75
+ formatValues: (values?: Record<string, any>, formatKey?: string) => Record<string, any>;
76
+ dispatch: (action: ActionModal, ...args: any[]) => void;
77
+ outputValues: (values?: Record<string, any>) => Record<string, any>;
78
+ addDispatchListener: AddDispatchListenerFn;
79
+ removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
112
80
  }
113
81
  export interface ConnectConfigModal {
114
- format?: Record<string, addFormatItemModal>;
82
+ format?: Record<string, addFormatItemModal>;
115
83
  }
116
84
  type ValueFormat = (value: Record<string, any>) => Record<string, any>;
117
85
  export interface FormatItemModal {
118
- inputValue: ValueFormat;
119
- outputValue: ValueFormat;
86
+ inputValue: ValueFormat;
87
+ outputValue: ValueFormat;
120
88
  }
121
- type addValueFormat = (
122
- item: HFormItemProps,
123
- value: Record<string, any>
124
- ) => Record<string, any>;
89
+ type addValueFormat = (item: HFormItemProps, value: Record<string, any>) => Record<string, any>;
125
90
  export interface addFormatItemModal {
126
- inputValue: addValueFormat;
127
- outputValue: addValueFormat;
91
+ inputValue: addValueFormat;
92
+ outputValue: addValueFormat;
128
93
  }
129
94
  export interface ConnectResultProps {
130
- addFormat?: (format: Record<string, addFormatItemModal>) => void;
131
- addDispatchListener?: (key: string, fn: argsFn) => void;
95
+ addFormat?: (format: Record<string, addFormatItemModal>) => void;
96
+ addDispatchListener?: (key: string, fn: argsFn) => void;
132
97
  }
133
98
  export {};
@@ -1,11 +1,11 @@
1
1
  // welcome to hoo hoo hoo
2
- import _extends from "@babel/runtime-corejs3/helpers/extends";
3
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
4
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
5
- import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
6
- import { Input, Button } from "antd";
7
- import React from "react";
8
- import { useRequest } from "ahooks";
2
+ import _extends from '@babel/runtime-corejs3/helpers/extends';
3
+ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
4
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
+ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
6
+ import { Input, Button } from 'antd';
7
+ import React from 'react';
8
+ import { useRequest } from 'ahooks';
9
9
 
10
10
  var _excluded = ["buttonProps", "value", "onChange", "children", "request"],
11
11
  _excluded2 = ["onClick", "type"];
@@ -21,81 +21,59 @@ var Index = function Index(_ref) {
21
21
  _buttonProps$type = buttonProps.type,
22
22
  type = _buttonProps$type === void 0 ? "primary" : _buttonProps$type,
23
23
  oProps = _objectWithoutProperties(buttonProps, _excluded2);
24
- var _useRequest = useRequest(
25
- function (val) {
26
- return request === null || request === void 0 ? void 0 : request(val);
27
- },
28
- {
29
- manual: true,
30
- }
31
- ),
24
+ var _useRequest = useRequest(function (val) {
25
+ return request === null || request === void 0 ? void 0 : request(val);
26
+ }, {
27
+ manual: true
28
+ }),
32
29
  run = _useRequest.run,
33
30
  loading = _useRequest.loading;
34
31
  var change = function change(e) {
35
- onChange === null || onChange === void 0
36
- ? void 0
37
- : onChange(e.target.value);
32
+ onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
38
33
  };
39
- var click = /*#__PURE__*/ (function () {
40
- var _ref2 = _asyncToGenerator(
41
- /*#__PURE__*/ _regeneratorRuntime.mark(function _callee(e) {
42
- var result;
43
- return _regeneratorRuntime.wrap(function _callee$(_context) {
44
- while (1)
45
- switch ((_context.prev = _context.next)) {
46
- case 0:
47
- result = value;
48
- if (!request) {
49
- _context.next = 5;
50
- break;
51
- }
52
- _context.next = 4;
53
- return run(value);
54
- case 4:
55
- result = _context.sent;
56
- case 5:
57
- onClick === null || onClick === void 0
58
- ? void 0
59
- : onClick(result, e);
60
- case 6:
61
- case "end":
62
- return _context.stop();
34
+ var click = /*#__PURE__*/function () {
35
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e) {
36
+ var result;
37
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
38
+ while (1) switch (_context.prev = _context.next) {
39
+ case 0:
40
+ result = value;
41
+ if (!request) {
42
+ _context.next = 5;
43
+ break;
63
44
  }
64
- }, _callee);
65
- })
66
- );
45
+ _context.next = 4;
46
+ return run(value);
47
+ case 4:
48
+ result = _context.sent;
49
+ case 5:
50
+ onClick === null || onClick === void 0 ? void 0 : onClick(result, e);
51
+ case 6:
52
+ case "end":
53
+ return _context.stop();
54
+ }
55
+ }, _callee);
56
+ }));
67
57
  return function click(_x) {
68
58
  return _ref2.apply(this, arguments);
69
59
  };
70
- })();
71
- return /*#__PURE__*/ React.createElement(
72
- Input.Group,
73
- {
74
- compact: true,
75
- style: {
76
- display: "flex",
77
- },
60
+ }();
61
+ return /*#__PURE__*/React.createElement(Input.Group, {
62
+ compact: true,
63
+ style: {
64
+ display: "flex"
65
+ }
66
+ }, /*#__PURE__*/React.createElement(Input, _extends({}, props, {
67
+ style: {
68
+ flex: 1
78
69
  },
79
- /*#__PURE__*/ React.createElement(
80
- Input,
81
- _extends({}, props, {
82
- style: {
83
- flex: 1,
84
- },
85
- value: value,
86
- onChange: change,
87
- })
88
- ),
89
- /*#__PURE__*/ React.createElement(
90
- Button,
91
- _extends({}, oProps, {
92
- type: type,
93
- onClick: click,
94
- loading: loading,
95
- }),
96
- children
97
- )
98
- );
70
+ value: value,
71
+ onChange: change
72
+ })), /*#__PURE__*/React.createElement(Button, _extends({}, oProps, {
73
+ type: type,
74
+ onClick: click,
75
+ loading: loading
76
+ }), children));
99
77
  };
100
78
 
101
79
  export { Index as default };
@@ -1,29 +1,20 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from "react";
3
- import _extends from "@babel/runtime-corejs3/helpers/extends";
4
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
5
- import { InputNumber } from "antd";
2
+ import React from 'react';
3
+ import _extends from '@babel/runtime-corejs3/helpers/extends';
4
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
+ import { InputNumber } from 'antd';
6
6
 
7
7
  var _excluded = ["style"];
8
- var HInputNumber = function (_ref) {
8
+ var HInputNumber = (function (_ref) {
9
9
  var _ref$style = _ref.style,
10
- style =
11
- _ref$style === void 0
12
- ? {
13
- width: "100%",
14
- }
15
- : _ref$style,
10
+ style = _ref$style === void 0 ? {
11
+ width: "100%"
12
+ } : _ref$style,
16
13
  props = _objectWithoutProperties(_ref, _excluded);
17
- return /*#__PURE__*/ React.createElement(
18
- InputNumber,
19
- _extends(
20
- {
21
- style: style,
22
- },
23
- props
24
- )
25
- );
26
- };
14
+ return /*#__PURE__*/React.createElement(InputNumber, _extends({
15
+ style: style
16
+ }, props));
17
+ });
27
18
 
28
19
  export { HInputNumber as default };
29
20
  // powered by hdj
@@ -1,21 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import type { HSelectInputProps } from "./modal";
3
3
  export declare enum SelectInputType {
4
- input = 0,
5
- select = 1,
4
+ input = 0,
5
+ select = 1
6
6
  }
7
- export declare const Index: ({
8
- selectProps,
9
- value,
10
- onChange,
11
- valueName,
12
- addFormat,
13
- ...props
14
- }: HSelectInputProps) => JSX.Element;
15
- declare const _default: (
16
- props: import("../Form/modal").HFormItemProps
17
- ) => import("react").ReactElement<
18
- import("../Form/modal").ConnectResultProps,
19
- string | import("react").JSXElementConstructor<any>
20
- >;
7
+ export declare const Index: ({ selectProps, value, onChange, valueName, addFormat, addDispatchListener, ...props }: HSelectInputProps) => JSX.Element;
8
+ declare const _default: (props: import("../Form/modal").HFormItemProps) => import("react").ReactElement<import("../Form/modal").ConnectResultProps, string | import("react").JSXElementConstructor<any>>;
21
9
  export default _default;