@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,77 +1,26 @@
1
1
  // welcome to hoo hoo hoo
2
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js/object/get-own-property-symbols";
3
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
4
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
5
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptors";
6
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js/object/define-properties";
7
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
8
- import _extends from "@babel/runtime-corejs3/helpers/extends";
9
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
10
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
11
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
12
- import _Object$values from "@babel/runtime-corejs3/core-js/object/values";
13
- import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
14
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
15
- import { DatePicker } from "antd";
16
- import {
17
- useGetTimeKey,
18
- useRangeValueProvider,
19
- useRangePickerTimeVal,
20
- } from "./hooks.js";
21
- import React, { useMemo } from "react";
22
- import { useMatchConfigProps } from "../hooks/index.js";
23
- import HFormConnect from "../Form/HFormConnect.js";
2
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
3
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
4
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
5
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
6
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
7
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
8
+ import _extends from '@babel/runtime-corejs3/helpers/extends';
9
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
10
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
11
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
12
+ import _Object$values from '@babel/runtime-corejs3/core-js/object/values';
13
+ import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
14
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
15
+ import { DatePicker } from 'antd';
16
+ import { useGetTimeKey, useRangeValueProvider, useRangePickerTimeVal } from './hooks.js';
17
+ import React, { useMemo } from 'react';
18
+ import { useMatchConfigProps } from '../hooks/index.js';
19
+ import HFormConnect from '../Form/HFormConnect.js';
24
20
 
25
- var _excluded = [
26
- "value",
27
- "onChange",
28
- "showTime",
29
- "format",
30
- "valueMap",
31
- "ranges",
32
- "name",
33
- "addFormat",
34
- ];
35
- function ownKeys(object, enumerableOnly) {
36
- var keys = _Object$keys(object);
37
- if (_Object$getOwnPropertySymbols) {
38
- var symbols = _Object$getOwnPropertySymbols(object);
39
- enumerableOnly &&
40
- (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
41
- return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
42
- })),
43
- keys.push.apply(keys, symbols);
44
- }
45
- return keys;
46
- }
47
- function _objectSpread(target) {
48
- for (var i = 1; i < arguments.length; i++) {
49
- var _context2, _context3;
50
- var source = null != arguments[i] ? arguments[i] : {};
51
- i % 2
52
- ? _forEachInstanceProperty(
53
- (_context2 = ownKeys(Object(source), !0))
54
- ).call(_context2, function (key) {
55
- _defineProperty(target, key, source[key]);
56
- })
57
- : _Object$getOwnPropertyDescriptors
58
- ? _Object$defineProperties(
59
- target,
60
- _Object$getOwnPropertyDescriptors(source)
61
- )
62
- : _forEachInstanceProperty((_context3 = ownKeys(Object(source)))).call(
63
- _context3,
64
- function (key) {
65
- _Object$defineProperty(
66
- target,
67
- key,
68
- _Object$getOwnPropertyDescriptor(source, key)
69
- );
70
- }
71
- );
72
- }
73
- return target;
74
- }
21
+ var _excluded = ["value", "onChange", "showTime", "format", "valueMap", "ranges", "name", "addFormat"];
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; }
75
24
  var RangePicker = DatePicker.RangePicker;
76
25
  var HRangePicker = function HRangePicker(_ref) {
77
26
  var value = _ref.value,
@@ -88,65 +37,56 @@ var HRangePicker = function HRangePicker(_ref) {
88
37
  props = _objectWithoutProperties(_ref, _excluded);
89
38
  var _useMatchConfigProps = useMatchConfigProps({
90
39
  valueRangePickerValueMap: valueMap,
91
- dateRanges: undefined,
40
+ dateRanges: undefined
92
41
  }),
93
42
  _useMatchConfigProps$ = _useMatchConfigProps.valueRangePickerValueMap,
94
- valueRangePickerValueMap =
95
- _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
43
+ valueRangePickerValueMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
96
44
  dateRanges = _useMatchConfigProps.dateRanges;
97
45
  var dateMapKeys = useGetTimeKey({
98
46
  valueMap: valueRangePickerValueMap,
99
- name: name,
47
+ name: name
100
48
  });
101
49
  var paramsProvider = useRangeValueProvider({
102
- valueMap: dateMapKeys,
50
+ valueMap: dateMapKeys
103
51
  });
104
52
  var timeVal = useRangePickerTimeVal({
105
53
  value: value,
106
54
  format: format,
107
- valueMap: dateMapKeys,
55
+ valueMap: dateMapKeys
108
56
  });
109
- var defaultRanges = useMemo(
110
- function () {
111
- if (!ranges) {
112
- return null;
113
- }
114
- if (ranges === true) {
115
- return dateRanges;
57
+ var defaultRanges = useMemo(function () {
58
+ if (!ranges) {
59
+ return null;
60
+ }
61
+ if (ranges === true) {
62
+ return dateRanges;
63
+ }
64
+ return ranges;
65
+ }, [ranges]);
66
+ addFormat === null || addFormat === void 0 ? void 0 : addFormat({
67
+ "float": {
68
+ inputValue: function inputValue(item, initValue) {
69
+ var _context;
70
+ var _item$name = item.name,
71
+ valueName = _item$name === void 0 ? "" : _item$name;
72
+ var resultObj = {};
73
+ _forEachInstanceProperty(_context = _Object$values(dateMapKeys)).call(_context, function (key) {
74
+ if (initValue[key]) {
75
+ resultObj[key] = initValue[key];
76
+ }
77
+ });
78
+ var hasKeys = _Object$keys(resultObj).length !== 0;
79
+ return _defineProperty({}, valueName, hasKeys ? resultObj : null);
80
+ },
81
+ outputValue: function outputValue(item, _outputValue) {
82
+ var _item$name2 = item.name,
83
+ valueName = _item$name2 === void 0 ? "" : _item$name2;
84
+ var _outputValue$valueNam = _outputValue[valueName],
85
+ itemVal = _outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
86
+ return _objectSpread({}, itemVal);
116
87
  }
117
- return ranges;
118
- },
119
- [ranges]
120
- );
121
- addFormat === null || addFormat === void 0
122
- ? void 0
123
- : addFormat({
124
- float: {
125
- inputValue: function inputValue(item, initValue) {
126
- var _context;
127
- var _item$name = item.name,
128
- valueName = _item$name === void 0 ? "" : _item$name;
129
- var resultObj = {};
130
- _forEachInstanceProperty(
131
- (_context = _Object$values(dateMapKeys))
132
- ).call(_context, function (key) {
133
- if (initValue[key]) {
134
- resultObj[key] = initValue[key];
135
- }
136
- });
137
- var hasKeys = _Object$keys(resultObj).length !== 0;
138
- return _defineProperty({}, valueName, hasKeys ? resultObj : null);
139
- },
140
- outputValue: function outputValue(item, _outputValue) {
141
- var _item$name2 = item.name,
142
- valueName = _item$name2 === void 0 ? "" : _item$name2;
143
- var _outputValue$valueNam = _outputValue[valueName],
144
- itemVal =
145
- _outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
146
- return _objectSpread({}, itemVal);
147
- },
148
- },
149
- });
88
+ }
89
+ });
150
90
  var change = function change(val) {
151
91
  if (!format || !val) {
152
92
  onChange === null || onChange === void 0 ? void 0 : onChange(val);
@@ -155,37 +95,26 @@ var HRangePicker = function HRangePicker(_ref) {
155
95
  var subVal = _mapInstanceProperty(val).call(val, function (item) {
156
96
  return item === null || item === void 0 ? void 0 : item.format(format);
157
97
  });
158
- onChange === null || onChange === void 0
159
- ? void 0
160
- : onChange(paramsProvider(subVal));
98
+ onChange === null || onChange === void 0 ? void 0 : onChange(paramsProvider(subVal));
161
99
  };
162
- return /*#__PURE__*/ React.createElement(
163
- RangePicker,
164
- _extends(
165
- {
166
- value: timeVal,
167
- onChange: change,
168
- showTime: showTime,
169
- ranges: defaultRanges,
170
- },
171
- props
172
- )
173
- );
100
+ return /*#__PURE__*/React.createElement(RangePicker, _extends({
101
+ value: timeVal,
102
+ onChange: change,
103
+ showTime: showTime,
104
+ ranges: defaultRanges
105
+ }, props));
174
106
  };
175
107
  var Index = HFormConnect(HRangePicker);
176
108
  var HRangePicker$1 = {
177
109
  Component: Index,
178
110
  placeholder: function placeholder(_ref3) {
179
111
  var label = _ref3.label;
180
- return [
181
- "\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label),
182
- "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label),
183
- ];
112
+ return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
184
113
  },
185
114
  requiredErrMsg: function requiredErrMsg(_ref4) {
186
115
  var label = _ref4.label;
187
116
  return "\u8BF7\u9009\u62E9".concat(label);
188
- },
117
+ }
189
118
  };
190
119
 
191
120
  export { HRangePicker$1 as default };
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { HTimePickerProps } from "./modal";
3
- declare const _default: ({
4
- value,
5
- format,
6
- onChange,
7
- ...props
8
- }: HTimePickerProps) => JSX.Element;
3
+ declare const _default: ({ value, format, onChange, ...props }: HTimePickerProps) => JSX.Element;
9
4
  export default _default;
@@ -1,12 +1,12 @@
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 { TimePicker } from "antd";
6
- import { useTimePickerValue, useTimePickerChange } from "./hooks.js";
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 { TimePicker } from 'antd';
6
+ import { useTimePickerValue, useTimePickerChange } from './hooks.js';
7
7
 
8
8
  var _excluded = ["value", "format", "onChange"];
9
- var HTimePicker = function (_ref) {
9
+ var HTimePicker = (function (_ref) {
10
10
  var value = _ref.value,
11
11
  _ref$format = _ref.format,
12
12
  format = _ref$format === void 0 ? "X" : _ref$format,
@@ -14,24 +14,18 @@ var HTimePicker = function (_ref) {
14
14
  props = _objectWithoutProperties(_ref, _excluded);
15
15
  var timeVal = useTimePickerValue({
16
16
  value: value,
17
- format: format,
17
+ format: format
18
18
  });
19
19
  var change = useTimePickerChange({
20
20
  value: value,
21
21
  format: format,
22
- onChange: onChange,
22
+ onChange: onChange
23
23
  });
24
- return /*#__PURE__*/ React.createElement(
25
- TimePicker,
26
- _extends(
27
- {
28
- value: timeVal,
29
- onChange: change,
30
- },
31
- props
32
- )
33
- );
34
- };
24
+ return /*#__PURE__*/React.createElement(TimePicker, _extends({
25
+ value: timeVal,
26
+ onChange: change
27
+ }, props));
28
+ });
35
29
 
36
30
  export { HTimePicker as default };
37
31
  // powered by hdj
@@ -2,52 +2,32 @@ import type { Moment, DurationInputArg2 } from "moment";
2
2
  import type { HRangePickerProps } from "./modal";
3
3
  import type { DateRangePickerValueMapModal } from "../modal";
4
4
  interface UseTimeValParams {
5
- value?: any | [any, any];
6
- format?: string;
7
- valueMap?: DateRangePickerValueMapModal;
5
+ value?: any | [any, any];
6
+ format?: string;
7
+ valueMap?: DateRangePickerValueMapModal;
8
8
  }
9
9
  interface UseTimePickerValParams {
10
- value?: any;
11
- format?: string | DurationInputArg2;
10
+ value?: any;
11
+ format?: string | DurationInputArg2;
12
12
  }
13
13
  interface UseTimeChangeParams {
14
- format?: string;
15
- onChange?: (time?: Moment | string | number) => void;
16
- value?: any;
14
+ format?: string;
15
+ onChange?: (time?: Moment | string | number) => void;
16
+ value?: any;
17
17
  }
18
18
  export declare const useTimeVal: ({ value, format }: UseTimeValParams) => any;
19
- export declare const useGetTimeKey: ({ valueMap, name }: HRangePickerProps) =>
20
- | {
21
- start?: undefined;
22
- end?: undefined;
23
- }
24
- | {
25
- start: string;
26
- end: string;
27
- };
28
- export declare const useTimeChange: ({
29
- format,
30
- onChange,
31
- }: UseTimeChangeParams) => (value: any) => void;
32
- export declare const useTimePickerValue: ({
33
- value,
34
- format,
35
- }: UseTimePickerValParams) => any;
36
- export declare const useTimePickerChange: ({
37
- value,
38
- format,
39
- onChange,
40
- }: UseTimeChangeParams) => (val: any) => void;
41
- export declare const useRangeValueProvider: ({
42
- valueMap,
43
- }: HRangePickerProps) => (val: any[]) =>
44
- | any[]
45
- | {
46
- [x: string]: any;
47
- };
48
- export declare const useRangePickerTimeVal: ({
49
- value,
50
- format,
51
- valueMap,
52
- }: UseTimeValParams) => any;
19
+ export declare const useGetTimeKey: ({ valueMap, name, }: HRangePickerProps) => {
20
+ start?: undefined;
21
+ end?: undefined;
22
+ } | {
23
+ start: string;
24
+ end: string;
25
+ };
26
+ export declare const useTimeChange: ({ format, onChange }: UseTimeChangeParams) => (value: any) => void;
27
+ export declare const useTimePickerValue: ({ value, format, }: UseTimePickerValParams) => any;
28
+ export declare const useTimePickerChange: ({ value, format, onChange, }: UseTimeChangeParams) => (val: any) => void;
29
+ export declare const useRangeValueProvider: ({ valueMap }: HRangePickerProps) => (val: any[]) => any[] | {
30
+ [x: string]: any;
31
+ };
32
+ export declare const useRangePickerTimeVal: ({ value, format, valueMap, }: UseTimeValParams) => any;
53
33
  export {};
@@ -1,22 +1,19 @@
1
1
  // welcome to hoo hoo hoo
2
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
3
- import _Array$isArray from "@babel/runtime-corejs3/core-js/array/is-array";
4
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
5
- import { useMemo, useCallback } from "react";
6
- import moment from "moment";
2
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
+ import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
4
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
5
+ import { useMemo, useCallback } from 'react';
6
+ import moment from 'moment';
7
7
 
8
8
  var useTimeVal = function useTimeVal(_ref) {
9
9
  var value = _ref.value,
10
10
  format = _ref.format;
11
- return useMemo(
12
- function () {
13
- if (!value || !format) {
14
- return value;
15
- }
16
- return moment(value, format);
17
- },
18
- [value, format]
19
- );
11
+ return useMemo(function () {
12
+ if (!value || !format) {
13
+ return value;
14
+ }
15
+ return moment(value, format);
16
+ }, [value, format]);
20
17
  };
21
18
  var useGetTimeKey = function useGetTimeKey(_ref2) {
22
19
  var _ref2$valueMap = _ref2.valueMap,
@@ -32,72 +29,57 @@ var useGetTimeKey = function useGetTimeKey(_ref2) {
32
29
  var endKey = typeof end === "string" ? end : end(name);
33
30
  return {
34
31
  start: startKey,
35
- end: endKey,
32
+ end: endKey
36
33
  };
37
34
  };
38
35
  var useTimeChange = function useTimeChange(_ref3) {
39
36
  var format = _ref3.format,
40
37
  onChange = _ref3.onChange;
41
- return useCallback(
42
- function (value) {
43
- if (!format) {
44
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
45
- return;
46
- }
47
- var subVal =
48
- value === null || value === void 0 ? void 0 : value.format(format);
49
- onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
50
- },
51
- [format, onChange]
52
- );
38
+ return useCallback(function (value) {
39
+ if (!format) {
40
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
41
+ return;
42
+ }
43
+ var subVal = value === null || value === void 0 ? void 0 : value.format(format);
44
+ onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
45
+ }, [format, onChange]);
53
46
  };
54
47
  var formatMap = {
55
48
  X: "s",
56
- x: "ms",
49
+ x: "ms"
57
50
  };
58
51
  var useTimePickerValue = function useTimePickerValue(_ref4) {
59
52
  var value = _ref4.value,
60
53
  format = _ref4.format;
61
- return useMemo(
62
- function () {
63
- if (!value || !format) {
64
- return value;
65
- }
66
- if (formatMap[format]) {
67
- var timeStr = moment()
68
- .startOf("days")
69
- .add(value, formatMap[format])
70
- .format("HH:mm:ss");
71
- return moment(timeStr, "HH:mm:ss");
72
- }
73
- return moment(value, format);
74
- },
75
- [value, format]
76
- );
54
+ return useMemo(function () {
55
+ if (!value || !format) {
56
+ return value;
57
+ }
58
+ if (formatMap[format]) {
59
+ var timeStr = moment().startOf("days").add(value, formatMap[format]).format("HH:mm:ss");
60
+ return moment(timeStr, "HH:mm:ss");
61
+ }
62
+ return moment(value, format);
63
+ }, [value, format]);
77
64
  };
78
65
  var useTimePickerChange = function useTimePickerChange(_ref5) {
79
66
  var value = _ref5.value,
80
67
  format = _ref5.format,
81
68
  onChange = _ref5.onChange;
82
- return useCallback(
83
- function (val) {
84
- if (!format || !val) {
85
- onChange === null || onChange === void 0 ? void 0 : onChange(val);
86
- return;
87
- }
88
- if (formatMap[format]) {
89
- var startTime = moment().startOf("days").format(format);
90
- var nowTime = val.format(format);
91
- onChange === null || onChange === void 0
92
- ? void 0
93
- : onChange(nowTime - startTime);
94
- return;
95
- }
96
- var subVal = val === null || val === void 0 ? void 0 : val.format(format);
97
- onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
98
- },
99
- [format, onChange, value]
100
- );
69
+ return useCallback(function (val) {
70
+ if (!format || !val) {
71
+ onChange === null || onChange === void 0 ? void 0 : onChange(val);
72
+ return;
73
+ }
74
+ if (formatMap[format]) {
75
+ var startTime = moment().startOf("days").format(format);
76
+ var nowTime = val.format(format);
77
+ onChange === null || onChange === void 0 ? void 0 : onChange(nowTime - startTime);
78
+ return;
79
+ }
80
+ var subVal = val === null || val === void 0 ? void 0 : val.format(format);
81
+ onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
82
+ }, [format, onChange, value]);
101
83
  };
102
84
  var useRangeValueProvider = function useRangeValueProvider(_ref6) {
103
85
  var _ref6$valueMap = _ref6.valueMap,
@@ -109,12 +91,7 @@ var useRangeValueProvider = function useRangeValueProvider(_ref6) {
109
91
  if (!start || !end) {
110
92
  return val;
111
93
  }
112
- return (
113
- (_ref7 = {}),
114
- _defineProperty(_ref7, start, val[0]),
115
- _defineProperty(_ref7, end, val[1]),
116
- _ref7
117
- );
94
+ return _ref7 = {}, _defineProperty(_ref7, start, val[0]), _defineProperty(_ref7, end, val[1]), _ref7;
118
95
  };
119
96
  };
120
97
  var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
@@ -122,45 +99,34 @@ var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
122
99
  format = _ref8.format,
123
100
  _ref8$valueMap = _ref8.valueMap,
124
101
  valueMap = _ref8$valueMap === void 0 ? {} : _ref8$valueMap;
125
- return useMemo(
126
- function () {
127
- if (!value || !format) {
128
- return value;
102
+ return useMemo(function () {
103
+ if (!value || !format) {
104
+ return value;
105
+ }
106
+ if (!_Array$isArray(value)) {
107
+ var start = valueMap.start,
108
+ end = valueMap.end;
109
+ if (!start || !end) {
110
+ console.error("日期value格式错误!");
111
+ return;
129
112
  }
130
- if (!_Array$isArray(value)) {
131
- var start = valueMap.start,
132
- end = valueMap.end;
133
- if (!start || !end) {
134
- console.error("日期value格式错误!");
135
- return;
136
- }
137
- var startTime = value[start],
138
- endTime = value[end];
139
- if (!startTime && !endTime) {
140
- return [];
141
- }
142
- var startMoment = moment(startTime, format);
143
- var endMoment = moment(endTime, format);
144
- return [startMoment, endMoment];
113
+ var startTime = value[start],
114
+ endTime = value[end];
115
+ if (!startTime && !endTime) {
116
+ return [];
145
117
  }
146
- return _mapInstanceProperty(value).call(value, function (item) {
147
- if (!item) {
148
- return item;
149
- }
150
- return moment(item, format);
151
- });
152
- },
153
- [value, format, valueMap]
154
- );
118
+ var startMoment = moment(startTime, format);
119
+ var endMoment = moment(endTime, format);
120
+ return [startMoment, endMoment];
121
+ }
122
+ return _mapInstanceProperty(value).call(value, function (item) {
123
+ if (!item) {
124
+ return item;
125
+ }
126
+ return moment(item, format);
127
+ });
128
+ }, [value, format, valueMap]);
155
129
  };
156
130
 
157
- export {
158
- useGetTimeKey,
159
- useRangePickerTimeVal,
160
- useRangeValueProvider,
161
- useTimeChange,
162
- useTimePickerChange,
163
- useTimePickerValue,
164
- useTimeVal,
165
- };
131
+ export { useGetTimeKey, useRangePickerTimeVal, useRangeValueProvider, useTimeChange, useTimePickerChange, useTimePickerValue, useTimeVal };
166
132
  // powered by hdj
@@ -1,10 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { HDatePickerProps } from "./modal";
3
- declare const _default: ({
4
- value,
5
- onChange,
6
- showTime,
7
- format,
8
- ...props
9
- }: HDatePickerProps) => JSX.Element;
3
+ declare const _default: ({ value, onChange, showTime, format, ...props }: HDatePickerProps) => JSX.Element;
10
4
  export default _default;