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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +63 -0
  45. package/es/ModalForm/index.d.ts +4 -0
  46. package/es/ModalForm/index.js +72 -0
  47. package/es/ModalForm/modal.d.ts +20 -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 +66 -0
  161. package/lib/ModalForm/index.d.ts +4 -0
  162. package/lib/ModalForm/index.js +75 -0
  163. package/lib/ModalForm/modal.d.ts +20 -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 +45 -0
  242. package/src/components/ModalForm/index.tsx +69 -0
  243. package/src/components/ModalForm/modal.ts +22 -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,68 +1,30 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from "react";
3
- import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
4
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js/object/get-own-property-symbols";
5
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
6
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
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 _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
13
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
14
- import _Object$values from "@babel/runtime-corejs3/core-js/object/values";
15
- import { Input } from "antd";
16
- import HSelect from "../Select/index.js";
17
- import { defaultValueName, defaultSelectStyle } from "./defaultConfig.js";
18
- import HFormConnect from "../Form/HFormConnect.js";
2
+ import React from 'react';
3
+ import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
4
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
5
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
6
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
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 _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
13
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
14
+ import _Object$values from '@babel/runtime-corejs3/core-js/object/values';
15
+ import { Input } from 'antd';
16
+ import HSelect from '../Select/index.js';
17
+ import { defaultValueName, defaultSelectStyle } from './defaultConfig.js';
18
+ import HFormConnect from '../Form/HFormConnect.js';
19
19
 
20
- var _excluded = ["selectProps", "value", "onChange", "valueName", "addFormat"],
20
+ var _excluded = ["selectProps", "value", "onChange", "valueName", "addFormat", "addDispatchListener"],
21
21
  _excluded2 = ["style", "placeholder"];
22
- function ownKeys(object, enumerableOnly) {
23
- var keys = _Object$keys(object);
24
- if (_Object$getOwnPropertySymbols) {
25
- var symbols = _Object$getOwnPropertySymbols(object);
26
- enumerableOnly &&
27
- (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
28
- return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
29
- })),
30
- keys.push.apply(keys, symbols);
31
- }
32
- return keys;
33
- }
34
- function _objectSpread(target) {
35
- for (var i = 1; i < arguments.length; i++) {
36
- var _context2, _context3;
37
- var source = null != arguments[i] ? arguments[i] : {};
38
- i % 2
39
- ? _forEachInstanceProperty(
40
- (_context2 = ownKeys(Object(source), !0))
41
- ).call(_context2, function (key) {
42
- _defineProperty(target, key, source[key]);
43
- })
44
- : _Object$getOwnPropertyDescriptors
45
- ? _Object$defineProperties(
46
- target,
47
- _Object$getOwnPropertyDescriptors(source)
48
- )
49
- : _forEachInstanceProperty((_context3 = ownKeys(Object(source)))).call(
50
- _context3,
51
- function (key) {
52
- _Object$defineProperty(
53
- target,
54
- key,
55
- _Object$getOwnPropertyDescriptor(source, key)
56
- );
57
- }
58
- );
59
- }
60
- return target;
61
- }
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 _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
62
24
  var SelectInputType;
63
25
  (function (SelectInputType) {
64
- SelectInputType[(SelectInputType["input"] = 0)] = "input";
65
- SelectInputType[(SelectInputType["select"] = 1)] = "select";
26
+ SelectInputType[SelectInputType["input"] = 0] = "input";
27
+ SelectInputType[SelectInputType["select"] = 1] = "select";
66
28
  })(SelectInputType || (SelectInputType = {}));
67
29
  var Index = function Index(_ref) {
68
30
  var _ref$selectProps = _ref.selectProps,
@@ -72,8 +34,9 @@ var Index = function Index(_ref) {
72
34
  onChange = _ref.onChange,
73
35
  _ref$valueName = _ref.valueName,
74
36
  valueName = _ref$valueName === void 0 ? defaultValueName : _ref$valueName,
75
- addFormat = _ref.addFormat,
76
- props = _objectWithoutProperties(_ref, _excluded);
37
+ addFormat = _ref.addFormat;
38
+ _ref.addDispatchListener;
39
+ var props = _objectWithoutProperties(_ref, _excluded);
77
40
  var _valueName$input = valueName.input,
78
41
  input = _valueName$input === void 0 ? "" : _valueName$input,
79
42
  _valueName$select = valueName.select,
@@ -81,11 +44,9 @@ var Index = function Index(_ref) {
81
44
  var inputVal = value[input],
82
45
  selectVal = value[select];
83
46
  var _selectProps$style = selectProps.style,
84
- style =
85
- _selectProps$style === void 0 ? defaultSelectStyle : _selectProps$style,
47
+ style = _selectProps$style === void 0 ? defaultSelectStyle : _selectProps$style,
86
48
  _selectProps$placehol = selectProps.placeholder,
87
- placeholder =
88
- _selectProps$placehol === void 0 ? "请选择" : _selectProps$placehol,
49
+ placeholder = _selectProps$placehol === void 0 ? "请选择" : _selectProps$placehol,
89
50
  sProps = _objectWithoutProperties(selectProps, _excluded2);
90
51
  var change = function change(val, key) {
91
52
  var newVal = _objectSpread({}, value);
@@ -93,57 +54,42 @@ var Index = function Index(_ref) {
93
54
  var type = key === input ? SelectInputType.input : SelectInputType.select;
94
55
  onChange === null || onChange === void 0 ? void 0 : onChange(newVal, type);
95
56
  };
96
- addFormat === null || addFormat === void 0
97
- ? void 0
98
- : addFormat({
99
- float: {
100
- inputValue: function inputValue(item, initValue) {
101
- var _context;
102
- var name = item.name;
103
- var resultObj = {};
104
- _forEachInstanceProperty(
105
- (_context = _Object$values(valueName))
106
- ).call(_context, function (key) {
107
- resultObj[key] = initValue[key];
108
- });
109
- return _defineProperty({}, name, resultObj);
110
- },
111
- outputValue: function outputValue(item, _outputValue) {
112
- var name = item.name;
113
- var _outputValue$name = _outputValue[name],
114
- itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
115
- var newItemVal = _defineProperty(
116
- {},
117
- itemVal[select],
118
- itemVal[input]
119
- );
120
- return _objectSpread({}, newItemVal);
121
- },
122
- },
123
- });
124
- return /*#__PURE__*/ React.createElement(
125
- Input,
126
- _extends(
127
- {
128
- value: inputVal,
129
- onChange: function onChange(e) {
130
- change(e.target.value, input);
131
- },
132
- addonBefore: /*#__PURE__*/ React.createElement(
133
- HSelect,
134
- _extends({}, sProps, {
135
- style: style,
136
- placeholder: placeholder,
137
- value: selectVal,
138
- onChange: function onChange(val) {
139
- change(val, select);
140
- },
141
- })
142
- ),
57
+ addFormat === null || addFormat === void 0 ? void 0 : addFormat({
58
+ "float": {
59
+ inputValue: function inputValue(item, initValue) {
60
+ var _context;
61
+ var _item$name = item.name,
62
+ name = _item$name === void 0 ? "" : _item$name;
63
+ var resultObj = {};
64
+ _forEachInstanceProperty(_context = _Object$values(valueName)).call(_context, function (key) {
65
+ resultObj[key] = initValue[key];
66
+ });
67
+ return _defineProperty({}, name, resultObj);
143
68
  },
144
- props
145
- )
146
- );
69
+ outputValue: function outputValue(item, _outputValue) {
70
+ var _item$name2 = item.name,
71
+ name = _item$name2 === void 0 ? "" : _item$name2;
72
+ var _outputValue$name = _outputValue[name],
73
+ itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
74
+ var newItemVal = _defineProperty({}, itemVal[select], itemVal[input]);
75
+ return _objectSpread({}, newItemVal);
76
+ }
77
+ }
78
+ });
79
+ return /*#__PURE__*/React.createElement(Input, _extends({
80
+ value: inputVal,
81
+ onChange: function onChange(e) {
82
+ change(e.target.value, input);
83
+ },
84
+ addonBefore: /*#__PURE__*/React.createElement(HSelect, _extends({}, sProps, {
85
+ style: style,
86
+ placeholder: placeholder,
87
+ value: selectVal,
88
+ onChange: function onChange(val) {
89
+ change(val, select);
90
+ }
91
+ }))
92
+ }, props));
147
93
  };
148
94
  var HSelectInput = HFormConnect(Index);
149
95
 
@@ -1,7 +1,7 @@
1
1
  export declare const defaultSelectStyle: {
2
- width: number;
2
+ width: number;
3
3
  };
4
4
  export declare const defaultValueName: {
5
- input: string;
6
- select: string;
5
+ input: string;
6
+ select: string;
7
7
  };
@@ -1,10 +1,10 @@
1
1
  // welcome to hoo hoo hoo
2
2
  var defaultSelectStyle = {
3
- width: 128,
3
+ width: 128
4
4
  };
5
5
  var defaultValueName = {
6
6
  input: "input",
7
- select: "select",
7
+ select: "select"
8
8
  };
9
9
 
10
10
  export { defaultSelectStyle, defaultValueName };
package/es/Input/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from "react";
3
- import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/objectDestructuringEmpty";
4
- import _extends from "@babel/runtime-corejs3/helpers/extends";
5
- import { Input } from "antd";
2
+ import React from 'react';
3
+ import _objectDestructuringEmpty from '@babel/runtime-corejs3/helpers/objectDestructuringEmpty';
4
+ import _extends from '@babel/runtime-corejs3/helpers/extends';
5
+ import { Input } from 'antd';
6
6
 
7
- var HInput = function (_ref) {
7
+ var HInput = (function (_ref) {
8
8
  var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
9
- return /*#__PURE__*/ React.createElement(Input, props);
10
- };
9
+ return /*#__PURE__*/React.createElement(Input, props);
10
+ });
11
11
 
12
12
  export { HInput as default };
13
13
  // powered by hdj
@@ -3,27 +3,25 @@ import type { HSelectProps } from "../Select/modal";
3
3
  import type { SelectInputType } from "./SelectInput";
4
4
  import type { PromiseFnResult } from "../modal";
5
5
  import type { addFormatItemModal } from "../Form/modal";
6
+ import type { AddDispatchListenerFn } from "../Form/modal";
6
7
  export type HInputProps = InputProps;
7
8
  interface ValueNameModal {
8
- input?: string;
9
- select?: string;
9
+ input?: string;
10
+ select?: string;
10
11
  }
11
- export interface HSelectInputProps
12
- extends Omit<HInputProps, "value" | "onChange"> {
13
- selectProps?: HSelectProps;
14
- value?: Record<string, any>;
15
- onChange?: (value: Record<string, any>, type: SelectInputType) => void;
16
- valueName?: ValueNameModal;
17
- addFormat?: (config: Record<string, addFormatItemModal>) => void;
12
+ export interface HSelectInputProps extends Omit<HInputProps, "value" | "onChange"> {
13
+ selectProps?: HSelectProps;
14
+ value?: Record<string, any>;
15
+ onChange?: (value: Record<string, any>, type: SelectInputType) => void;
16
+ valueName?: ValueNameModal;
17
+ addFormat?: (config: Record<string, addFormatItemModal>) => void;
18
+ addDispatchListener?: AddDispatchListenerFn;
18
19
  }
19
20
  export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
20
- onClick: (
21
- value: string | readonly string[] | number | undefined,
22
- e: HTMLElement
23
- ) => void;
21
+ onClick: (value: string | readonly string[] | number | undefined, e: HTMLElement) => void;
24
22
  }
25
23
  export interface HButtonInputProps extends HInputProps {
26
- buttonProps?: HButtonProps;
27
- request?: PromiseFnResult;
24
+ buttonProps?: HButtonProps;
25
+ request?: PromiseFnResult;
28
26
  }
29
27
  export {};
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { HModalFormInstance, ModifyPropsModal } from "@/components/ModalForm/modal";
3
+ export declare const useModifyProps: ({ visible, configData, initialValues, }: ModifyPropsModal) => {
4
+ modalFormData: import("../Form/modal").HItemProps[];
5
+ modalVisible: boolean | undefined;
6
+ setModalVisible: import("react").Dispatch<import("react").SetStateAction<boolean | undefined>>;
7
+ setModalFormData: import("react").Dispatch<import("react").SetStateAction<import("../Form/modal").HItemProps[]>>;
8
+ initValue: Record<string, any> | undefined;
9
+ setInitValue: import("react").Dispatch<import("react").SetStateAction<Record<string, any> | undefined>>;
10
+ };
11
+ export declare const useHModalForm: () => HModalFormInstance;
12
+ export declare const useCurrentForm: (hModalForm?: HModalFormInstance) => HModalFormInstance;
@@ -0,0 +1,63 @@
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 _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
11
+ import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
12
+ import { useMemo, useState, useEffect } from 'react';
13
+ import useHForm from '../Form/hooks/useHForm.js';
14
+
15
+ 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; }
16
+ 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; }
17
+ var useModifyProps = function useModifyProps(_ref) {
18
+ var visible = _ref.visible,
19
+ configData = _ref.configData,
20
+ initialValues = _ref.initialValues;
21
+ var _useState = useState(visible),
22
+ _useState2 = _slicedToArray(_useState, 2),
23
+ modalVisible = _useState2[0],
24
+ setModalVisible = _useState2[1];
25
+ var _useState3 = useState(configData),
26
+ _useState4 = _slicedToArray(_useState3, 2),
27
+ modalFormData = _useState4[0],
28
+ setModalFormData = _useState4[1];
29
+ var _useState5 = useState(initialValues),
30
+ _useState6 = _slicedToArray(_useState5, 2),
31
+ initValue = _useState6[0],
32
+ setInitValue = _useState6[1];
33
+ useEffect(function () {
34
+ setModalVisible(visible);
35
+ }, [visible]);
36
+ useEffect(function () {
37
+ setModalFormData(configData);
38
+ }, [configData]);
39
+ return {
40
+ modalFormData: modalFormData,
41
+ modalVisible: modalVisible,
42
+ setModalVisible: setModalVisible,
43
+ setModalFormData: setModalFormData,
44
+ initValue: initValue,
45
+ setInitValue: setInitValue
46
+ };
47
+ };
48
+ var useHModalForm = function useHModalForm() {
49
+ var hForm = useHForm();
50
+ return useMemo(function () {
51
+ return _objectSpread(_objectSpread({}, hForm), {}, {
52
+ show: function show(params) {},
53
+ hide: function hide() {}
54
+ });
55
+ }, []);
56
+ };
57
+ var useCurrentForm = function useCurrentForm(hModalForm) {
58
+ var defaultHModalForm = useHModalForm();
59
+ return hModalForm || defaultHModalForm;
60
+ };
61
+
62
+ export { useCurrentForm, useHModalForm, useModifyProps };
63
+ // powered by hdj
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { ModalFormProps } from "@/components/ModalForm/modal";
3
+ declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, modalForm, initialValues, ...props }: ModalFormProps) => JSX.Element;
4
+ export default _default;
@@ -0,0 +1,72 @@
1
+ // welcome to hoo hoo hoo
2
+ import React, { useEffect } from 'react';
3
+ import _extends from '@babel/runtime-corejs3/helpers/extends';
4
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
5
+ import { Modal } from 'antd';
6
+ import HForm from '../Form/index.js';
7
+ import { useModifyProps, useCurrentForm } from './hooks.js';
8
+
9
+ var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "modalForm", "initialValues"];
10
+ var ModalForm = (function (_ref) {
11
+ var visible = _ref.visible,
12
+ title = _ref.title,
13
+ onCancel = _ref.onCancel,
14
+ configData = _ref.configData,
15
+ infoRequest = _ref.infoRequest;
16
+ _ref.request;
17
+ var _afterClose = _ref.afterClose,
18
+ modalForm = _ref.modalForm,
19
+ _ref$initialValues = _ref.initialValues,
20
+ initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
+ var _useModifyProps = useModifyProps({
23
+ configData: configData,
24
+ visible: visible,
25
+ initialValues: initialValues
26
+ }),
27
+ modalVisible = _useModifyProps.modalVisible,
28
+ modalFormData = _useModifyProps.modalFormData,
29
+ setModalVisible = _useModifyProps.setModalVisible,
30
+ setModalFormData = _useModifyProps.setModalFormData,
31
+ initValue = _useModifyProps.initValue,
32
+ setInitValue = _useModifyProps.setInitValue;
33
+ var currentForm = useCurrentForm(modalForm);
34
+ useEffect(function () {
35
+ currentForm.show = function (_ref2) {
36
+ var changeConfigData = _ref2.configData,
37
+ changeInitialValues = _ref2.initialValues;
38
+ if (!!changeConfigData) {
39
+ setModalFormData(changeConfigData);
40
+ }
41
+ setInitValue(changeInitialValues);
42
+ setModalVisible(true);
43
+ };
44
+ currentForm.hide = function () {
45
+ setModalVisible(false);
46
+ };
47
+ }, []);
48
+ var cancel = function cancel(e) {
49
+ if (onCancel) {
50
+ return onCancel === null || onCancel === void 0 ? void 0 : onCancel(e);
51
+ }
52
+ setModalVisible(false);
53
+ };
54
+ return /*#__PURE__*/React.createElement(Modal, _extends({
55
+ title: title,
56
+ visible: modalVisible,
57
+ onCancel: cancel,
58
+ afterClose: function afterClose() {
59
+ currentForm.resetFields();
60
+ _afterClose === null || _afterClose === void 0 ? void 0 : _afterClose();
61
+ }
62
+ }, props), /*#__PURE__*/React.createElement(HForm, _extends({
63
+ configData: modalFormData,
64
+ initialValues: initValue
65
+ }, props, {
66
+ form: currentForm,
67
+ infoRequest: infoRequest
68
+ })));
69
+ });
70
+
71
+ export { ModalForm as default };
72
+ // powered by hdj
@@ -0,0 +1,20 @@
1
+ import type { HFormProps } from "@/components/Form/modal";
2
+ import type { ModalProps } from "antd";
3
+ import type { HFormInstance, HItemProps } from "@/components/Form/modal";
4
+ type RootProps = HFormProps & ModalProps;
5
+ export interface ModifyPropsModal {
6
+ configData: HItemProps[];
7
+ visible?: boolean;
8
+ initialValues?: Record<string, any>;
9
+ }
10
+ export interface ShowParamsModal extends Partial<ModifyPropsModal> {
11
+ initialValues?: Record<string, any>;
12
+ }
13
+ export interface HModalFormInstance extends HFormInstance {
14
+ show: (data: ShowParamsModal) => void;
15
+ hide: VoidFunction;
16
+ }
17
+ export interface ModalFormProps extends RootProps {
18
+ modalForm?: HModalFormInstance;
19
+ }
20
+ export {};
@@ -1,55 +1,33 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from "react";
3
- import { Typography, Row, Space, Button } from "antd";
4
- import { ExclamationCircleOutlined } from "@ant-design/icons";
2
+ import React from 'react';
3
+ import { Typography, Row, Space, Button } from 'antd';
4
+ import { ExclamationCircleOutlined } from '@ant-design/icons';
5
5
 
6
6
  var Text = Typography.Text;
7
- var ErrorComponent = function (_ref) {
7
+ var ErrorComponent = (function (_ref) {
8
8
  var error = _ref.error,
9
9
  reload = _ref.reload;
10
- return /*#__PURE__*/ React.createElement(
11
- Row,
12
- {
13
- justify: "center",
14
- align: "middle",
15
- style: {
16
- height: 125,
17
- },
18
- },
19
- /*#__PURE__*/ React.createElement(
20
- Space,
21
- {
22
- align: "center",
23
- direction: "vertical",
24
- },
25
- /*#__PURE__*/ React.createElement(
26
- Text,
27
- {
28
- type: "danger",
29
- },
30
- /*#__PURE__*/ React.createElement(ExclamationCircleOutlined, {
31
- size: 24,
32
- })
33
- ),
34
- /*#__PURE__*/ React.createElement(
35
- Text,
36
- {
37
- type: "danger",
38
- },
39
- error === null || error === void 0 ? void 0 : error.message
40
- ),
41
- /*#__PURE__*/ React.createElement(
42
- Button,
43
- {
44
- type: "primary",
45
- size: "small",
46
- onClick: reload,
47
- },
48
- "\u91CD\u65B0\u52A0\u8F7D"
49
- )
50
- )
51
- );
52
- };
10
+ return /*#__PURE__*/React.createElement(Row, {
11
+ justify: "center",
12
+ align: "middle",
13
+ style: {
14
+ height: 125
15
+ }
16
+ }, /*#__PURE__*/React.createElement(Space, {
17
+ align: "center",
18
+ direction: "vertical"
19
+ }, /*#__PURE__*/React.createElement(Text, {
20
+ type: "danger"
21
+ }, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, {
22
+ size: 24
23
+ })), /*#__PURE__*/React.createElement(Text, {
24
+ type: "danger"
25
+ }, error === null || error === void 0 ? void 0 : error.message), /*#__PURE__*/React.createElement(Button, {
26
+ type: "primary",
27
+ size: "small",
28
+ onClick: reload
29
+ }, "\u91CD\u65B0\u52A0\u8F7D")));
30
+ });
53
31
 
54
32
  export { ErrorComponent as default };
55
33
  // powered by hdj
@@ -1,22 +1,18 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from "react";
3
- import { Row, Spin } from "antd";
2
+ import React from 'react';
3
+ import { Row, Spin } from 'antd';
4
4
 
5
- var Loading = function () {
6
- return /*#__PURE__*/ React.createElement(
7
- Row,
8
- {
9
- justify: "center",
10
- align: "middle",
11
- style: {
12
- height: 125,
13
- },
14
- },
15
- /*#__PURE__*/ React.createElement(Spin, {
16
- size: "large",
17
- })
18
- );
19
- };
5
+ var Loading = (function () {
6
+ return /*#__PURE__*/React.createElement(Row, {
7
+ justify: "center",
8
+ align: "middle",
9
+ style: {
10
+ height: 125
11
+ }
12
+ }, /*#__PURE__*/React.createElement(Spin, {
13
+ size: "large"
14
+ }));
15
+ });
20
16
 
21
17
  export { Loading as default };
22
18
  // powered by hdj
@@ -1,7 +1,7 @@
1
1
  // welcome to hoo hoo hoo
2
- import React from "react";
3
- import Loading from "./LoadingComponent.js";
4
- import ErrorComponent from "./ErrorComponent.js";
2
+ import React from 'react';
3
+ import Loading from './LoadingComponent.js';
4
+ import ErrorComponent from './ErrorComponent.js';
5
5
 
6
6
  var Index = function Index(_ref) {
7
7
  var error = _ref.error,
@@ -9,15 +9,15 @@ var Index = function Index(_ref) {
9
9
  reload = _ref.reload,
10
10
  children = _ref.children;
11
11
  if (error) {
12
- return /*#__PURE__*/ React.createElement(ErrorComponent, {
12
+ return /*#__PURE__*/React.createElement(ErrorComponent, {
13
13
  error: error,
14
- reload: reload,
14
+ reload: reload
15
15
  });
16
16
  }
17
17
  if (data) {
18
- return /*#__PURE__*/ React.createElement(React.Fragment, null, children);
18
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
19
19
  }
20
- return /*#__PURE__*/ React.createElement(Loading, null);
20
+ return /*#__PURE__*/React.createElement(Loading, null);
21
21
  };
22
22
 
23
23
  export { Index as default };
@@ -1,6 +1,6 @@
1
1
  export interface IHPageHandler<T = any> {
2
- loading?: boolean;
3
- error?: Error;
4
- reload: VoidFunction;
5
- data?: T;
2
+ loading?: boolean;
3
+ error?: Error;
4
+ reload: VoidFunction;
5
+ data?: T;
6
6
  }