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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/es/CheckboxGroup/CheckBox/index.js +24 -16
  2. package/es/CheckboxGroup/hooks.d.ts +9 -3
  3. package/es/CheckboxGroup/hooks.js +115 -64
  4. package/es/CheckboxGroup/index.d.ts +6 -1
  5. package/es/CheckboxGroup/index.js +117 -56
  6. package/es/CheckboxGroup/modal.d.ts +9 -8
  7. package/es/Form/Context/FormConfigProvider.js +64 -19
  8. package/es/Form/Context/index.d.ts +4 -1
  9. package/es/Form/Context/index.js +3 -3
  10. package/es/Form/FormItem/BasicItem.js +80 -42
  11. package/es/Form/FormItem/Helper.d.ts +1 -1
  12. package/es/Form/FormItem/Helper.js +17 -9
  13. package/es/Form/FormItem/RegularFormItem.js +11 -8
  14. package/es/Form/FormItem/UpFormItem.d.ts +6 -1
  15. package/es/Form/FormItem/UpFormItem.js +27 -17
  16. package/es/Form/FormItem/hooks.d.ts +21 -4
  17. package/es/Form/FormItem/hooks.js +12 -9
  18. package/es/Form/FormItem/index.js +5 -5
  19. package/es/Form/HFormConnect.d.ts +9 -1
  20. package/es/Form/HFormConnect.js +94 -26
  21. package/es/Form/InitSet.d.ts +1 -1
  22. package/es/Form/InitSet.js +5 -5
  23. package/es/Form/Label.d.ts +4 -4
  24. package/es/Form/Label.js +36 -19
  25. package/es/Form/config.d.ts +100 -22
  26. package/es/Form/config.js +19 -19
  27. package/es/Form/hooks/index.d.ts +12 -5
  28. package/es/Form/hooks/index.js +65 -49
  29. package/es/Form/hooks/useHForm.js +233 -95
  30. package/es/Form/hooks/useInitConfigData.d.ts +4 -1
  31. package/es/Form/hooks/useInitConfigData.js +143 -61
  32. package/es/Form/index.d.ts +11 -1
  33. package/es/Form/index.js +71 -40
  34. package/es/Form/modal.d.ts +92 -51
  35. package/es/Input/ButtonInput.js +73 -51
  36. package/es/Input/InputNumber.js +21 -12
  37. package/es/Input/SelectInput.d.ts +16 -4
  38. package/es/Input/SelectInput.js +113 -56
  39. package/es/Input/defaultConfig.d.ts +3 -3
  40. package/es/Input/defaultConfig.js +2 -2
  41. package/es/Input/index.js +7 -7
  42. package/es/Input/modal.d.ts +15 -11
  43. package/es/PageHandler/ErrorComponent.js +47 -25
  44. package/es/PageHandler/LoadingComponent.js +17 -13
  45. package/es/PageHandler/index.js +7 -7
  46. package/es/PageHandler/modal.d.ts +4 -4
  47. package/es/RadioGroup/index.d.ts +12 -5
  48. package/es/RadioGroup/index.js +46 -33
  49. package/es/Select/components/AllSelect.d.ts +1 -1
  50. package/es/Select/components/AllSelect.js +40 -18
  51. package/es/Select/components/CheckBoxOption.d.ts +6 -3
  52. package/es/Select/components/CheckBoxOption.js +12 -7
  53. package/es/Select/components/DropdownComponent.d.ts +4 -4
  54. package/es/Select/components/DropdownComponent.js +30 -17
  55. package/es/Select/components/NoFindItem.d.ts +1 -1
  56. package/es/Select/components/NoFindItem.js +11 -7
  57. package/es/Select/components/NotFoundContent.d.ts +2 -2
  58. package/es/Select/components/NotFoundContent.js +49 -27
  59. package/es/Select/defaultConfig.d.ts +1 -1
  60. package/es/Select/defaultConfig.js +20 -16
  61. package/es/Select/hooks/changeHooks.d.ts +2 -2
  62. package/es/Select/hooks/changeHooks.js +147 -71
  63. package/es/Select/hooks/norHooks.d.ts +27 -9
  64. package/es/Select/hooks/norHooks.js +51 -39
  65. package/es/Select/index.d.ts +22 -1
  66. package/es/Select/index.js +124 -65
  67. package/es/Select/modal.d.ts +15 -15
  68. package/es/Select/utils.js +60 -15
  69. package/es/Submit/index.d.ts +9 -3
  70. package/es/Submit/index.js +18 -13
  71. package/es/Switch/index.d.ts +4 -4
  72. package/es/Switch/index.js +46 -20
  73. package/es/TDPicker/RangePicker.d.ts +8 -3
  74. package/es/TDPicker/RangePicker.js +138 -62
  75. package/es/TDPicker/TimePicker.d.ts +6 -1
  76. package/es/TDPicker/TimePicker.js +19 -13
  77. package/es/TDPicker/hooks.d.ts +42 -22
  78. package/es/TDPicker/hooks.js +106 -72
  79. package/es/TDPicker/index.d.ts +7 -1
  80. package/es/TDPicker/index.js +20 -14
  81. package/es/TDPicker/modal.d.ts +21 -16
  82. package/es/Upload/Btn.d.ts +5 -1
  83. package/es/Upload/Btn.js +35 -19
  84. package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
  85. package/es/Upload/MediaTypeEle/TypeEle.js +31 -23
  86. package/es/Upload/MediaTypeEle/index.d.ts +5 -1
  87. package/es/Upload/MediaTypeEle/index.js +21 -18
  88. package/es/Upload/Preview/index.d.ts +5 -1
  89. package/es/Upload/Preview/index.js +17 -13
  90. package/es/Upload/UrlUpload/index.d.ts +7 -1
  91. package/es/Upload/UrlUpload/index.js +72 -51
  92. package/es/Upload/enums.d.ts +3 -3
  93. package/es/Upload/enums.js +3 -3
  94. package/es/Upload/hooks/change.d.ts +8 -1
  95. package/es/Upload/hooks/change.js +115 -58
  96. package/es/Upload/hooks/customRequest.d.ts +5 -1
  97. package/es/Upload/hooks/customRequest.js +63 -46
  98. package/es/Upload/hooks/propsMaker.d.ts +5 -1
  99. package/es/Upload/hooks/propsMaker.js +52 -13
  100. package/es/Upload/index.d.ts +3 -1
  101. package/es/Upload/index.js +131 -61
  102. package/es/Upload/modal.d.ts +17 -15
  103. package/es/Upload/util.d.ts +8 -2
  104. package/es/Upload/util.js +15 -7
  105. package/es/config.js +34 -31
  106. package/es/hooks/index.d.ts +14 -7
  107. package/es/hooks/index.js +124 -49
  108. package/es/index.d.ts +98 -16
  109. package/es/index.js +22 -5
  110. package/es/modal.d.ts +6 -6
  111. package/lib/CheckboxGroup/CheckBox/index.js +26 -18
  112. package/lib/CheckboxGroup/hooks.d.ts +9 -3
  113. package/lib/CheckboxGroup/hooks.js +116 -65
  114. package/lib/CheckboxGroup/index.d.ts +6 -1
  115. package/lib/CheckboxGroup/index.js +119 -58
  116. package/lib/CheckboxGroup/modal.d.ts +9 -8
  117. package/lib/Form/Context/FormConfigProvider.js +66 -21
  118. package/lib/Form/Context/index.d.ts +4 -1
  119. package/lib/Form/Context/index.js +4 -4
  120. package/lib/Form/FormItem/BasicItem.js +82 -44
  121. package/lib/Form/FormItem/Helper.d.ts +1 -1
  122. package/lib/Form/FormItem/Helper.js +19 -11
  123. package/lib/Form/FormItem/RegularFormItem.js +13 -10
  124. package/lib/Form/FormItem/UpFormItem.d.ts +6 -1
  125. package/lib/Form/FormItem/UpFormItem.js +29 -19
  126. package/lib/Form/FormItem/hooks.d.ts +21 -4
  127. package/lib/Form/FormItem/hooks.js +13 -10
  128. package/lib/Form/FormItem/index.js +7 -7
  129. package/lib/Form/HFormConnect.d.ts +9 -1
  130. package/lib/Form/HFormConnect.js +96 -28
  131. package/lib/Form/InitSet.d.ts +1 -1
  132. package/lib/Form/InitSet.js +7 -7
  133. package/lib/Form/Label.d.ts +4 -4
  134. package/lib/Form/Label.js +41 -21
  135. package/lib/Form/config.d.ts +100 -22
  136. package/lib/Form/config.js +21 -21
  137. package/lib/Form/hooks/index.d.ts +12 -5
  138. package/lib/Form/hooks/index.js +66 -50
  139. package/lib/Form/hooks/useHForm.js +235 -97
  140. package/lib/Form/hooks/useInitConfigData.d.ts +4 -1
  141. package/lib/Form/hooks/useInitConfigData.js +144 -63
  142. package/lib/Form/index.d.ts +11 -1
  143. package/lib/Form/index.js +73 -42
  144. package/lib/Form/modal.d.ts +92 -51
  145. package/lib/Input/ButtonInput.js +75 -53
  146. package/lib/Input/InputNumber.js +23 -14
  147. package/lib/Input/SelectInput.d.ts +16 -4
  148. package/lib/Input/SelectInput.js +125 -60
  149. package/lib/Input/defaultConfig.d.ts +3 -3
  150. package/lib/Input/defaultConfig.js +3 -3
  151. package/lib/Input/index.js +9 -9
  152. package/lib/Input/modal.d.ts +15 -11
  153. package/lib/PageHandler/ErrorComponent.js +49 -27
  154. package/lib/PageHandler/LoadingComponent.js +19 -15
  155. package/lib/PageHandler/index.js +9 -9
  156. package/lib/PageHandler/modal.d.ts +4 -4
  157. package/lib/RadioGroup/index.d.ts +12 -5
  158. package/lib/RadioGroup/index.js +48 -35
  159. package/lib/Select/components/AllSelect.d.ts +1 -1
  160. package/lib/Select/components/AllSelect.js +42 -20
  161. package/lib/Select/components/CheckBoxOption.d.ts +6 -3
  162. package/lib/Select/components/CheckBoxOption.js +14 -9
  163. package/lib/Select/components/DropdownComponent.d.ts +4 -4
  164. package/lib/Select/components/DropdownComponent.js +32 -19
  165. package/lib/Select/components/NoFindItem.d.ts +1 -1
  166. package/lib/Select/components/NoFindItem.js +13 -9
  167. package/lib/Select/components/NotFoundContent.d.ts +2 -2
  168. package/lib/Select/components/NotFoundContent.js +51 -29
  169. package/lib/Select/defaultConfig.d.ts +1 -1
  170. package/lib/Select/defaultConfig.js +21 -17
  171. package/lib/Select/hooks/changeHooks.d.ts +2 -2
  172. package/lib/Select/hooks/changeHooks.js +148 -72
  173. package/lib/Select/hooks/norHooks.d.ts +27 -9
  174. package/lib/Select/hooks/norHooks.js +52 -40
  175. package/lib/Select/index.d.ts +22 -1
  176. package/lib/Select/index.js +128 -67
  177. package/lib/Select/modal.d.ts +15 -15
  178. package/lib/Select/utils.js +61 -16
  179. package/lib/Submit/index.d.ts +9 -3
  180. package/lib/Submit/index.js +20 -15
  181. package/lib/Switch/index.d.ts +4 -4
  182. package/lib/Switch/index.js +48 -22
  183. package/lib/TDPicker/RangePicker.d.ts +8 -3
  184. package/lib/TDPicker/RangePicker.js +136 -64
  185. package/lib/TDPicker/TimePicker.d.ts +6 -1
  186. package/lib/TDPicker/TimePicker.js +21 -15
  187. package/lib/TDPicker/hooks.d.ts +42 -22
  188. package/lib/TDPicker/hooks.js +98 -72
  189. package/lib/TDPicker/index.d.ts +7 -1
  190. package/lib/TDPicker/index.js +22 -16
  191. package/lib/TDPicker/modal.d.ts +21 -16
  192. package/lib/Upload/Btn.d.ts +5 -1
  193. package/lib/Upload/Btn.js +37 -21
  194. package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
  195. package/lib/Upload/MediaTypeEle/TypeEle.js +33 -25
  196. package/lib/Upload/MediaTypeEle/index.d.ts +5 -1
  197. package/lib/Upload/MediaTypeEle/index.js +23 -20
  198. package/lib/Upload/Preview/index.d.ts +5 -1
  199. package/lib/Upload/Preview/index.js +19 -15
  200. package/lib/Upload/UrlUpload/index.d.ts +7 -1
  201. package/lib/Upload/UrlUpload/index.js +74 -53
  202. package/lib/Upload/enums.d.ts +3 -3
  203. package/lib/Upload/enums.js +4 -4
  204. package/lib/Upload/hooks/change.d.ts +8 -1
  205. package/lib/Upload/hooks/change.js +116 -59
  206. package/lib/Upload/hooks/customRequest.d.ts +5 -1
  207. package/lib/Upload/hooks/customRequest.js +64 -47
  208. package/lib/Upload/hooks/propsMaker.d.ts +5 -1
  209. package/lib/Upload/hooks/propsMaker.js +55 -15
  210. package/lib/Upload/index.d.ts +3 -1
  211. package/lib/Upload/index.js +133 -63
  212. package/lib/Upload/modal.d.ts +17 -15
  213. package/lib/Upload/util.d.ts +8 -2
  214. package/lib/Upload/util.js +16 -8
  215. package/lib/config.js +35 -32
  216. package/lib/hooks/index.d.ts +14 -7
  217. package/lib/hooks/index.js +125 -50
  218. package/lib/index.d.ts +98 -16
  219. package/lib/index.js +5 -5
  220. package/lib/modal.d.ts +6 -6
  221. package/package.json +2 -2
  222. package/src/components/CheckboxGroup/index.tsx +2 -2
  223. package/src/components/Form/FormItem/Helper.tsx +3 -4
  224. package/src/components/Form/HFormConnect.tsx +6 -2
  225. package/src/components/Form/hooks/useHForm.ts +59 -10
  226. package/src/components/Form/modal.ts +12 -8
  227. package/src/components/TDPicker/RangePicker.tsx +7 -5
  228. package/src/components/TDPicker/modal.ts +1 -0
  229. package/src/pages/Form/index.tsx +2 -2
@@ -1,26 +1,77 @@
1
1
  // welcome to hoo hoo hoo
2
- import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
3
- import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
4
- import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
5
- import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
6
- import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
7
- import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
8
- import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
9
- import _extends from '@babel/runtime-corejs3/helpers/extends';
10
- import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
11
- import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
12
- import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
13
- import _Object$values from '@babel/runtime-corejs3/core-js/object/values';
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';
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";
20
24
 
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; }
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
+ }
24
75
  var RangePicker = DatePicker.RangePicker;
25
76
  var HRangePicker = function HRangePicker(_ref) {
26
77
  var value = _ref.value,
@@ -37,51 +88,65 @@ var HRangePicker = function HRangePicker(_ref) {
37
88
  props = _objectWithoutProperties(_ref, _excluded);
38
89
  var _useMatchConfigProps = useMatchConfigProps({
39
90
  valueRangePickerValueMap: valueMap,
40
- dateRanges: undefined
91
+ dateRanges: undefined,
41
92
  }),
42
93
  _useMatchConfigProps$ = _useMatchConfigProps.valueRangePickerValueMap,
43
- valueRangePickerValueMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
94
+ valueRangePickerValueMap =
95
+ _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$,
44
96
  dateRanges = _useMatchConfigProps.dateRanges;
45
97
  var dateMapKeys = useGetTimeKey({
46
98
  valueMap: valueRangePickerValueMap,
47
- name: name
99
+ name: name,
48
100
  });
49
101
  var paramsProvider = useRangeValueProvider({
50
- valueMap: dateMapKeys
102
+ valueMap: dateMapKeys,
51
103
  });
52
104
  var timeVal = useRangePickerTimeVal({
53
105
  value: value,
54
106
  format: format,
55
- valueMap: dateMapKeys
107
+ valueMap: dateMapKeys,
56
108
  });
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 valueName = item.name;
71
- var resultObj = {};
72
- _forEachInstanceProperty(_context = _Object$values(dateMapKeys)).call(_context, function (key) {
73
- resultObj[key] = initValue[key];
74
- });
75
- return _defineProperty({}, valueName, resultObj);
76
- },
77
- outputValue: function outputValue(item, _outputValue) {
78
- var valueName = item.name;
79
- var _outputValue$valueNam = _outputValue[valueName],
80
- itemVal = _outputValue$valueNam === void 0 ? {} : _outputValue$valueNam;
81
- return _objectSpread({}, itemVal);
109
+ var defaultRanges = useMemo(
110
+ function () {
111
+ if (!ranges) {
112
+ return null;
82
113
  }
83
- }
84
- });
114
+ if (ranges === true) {
115
+ return dateRanges;
116
+ }
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
+ });
85
150
  var change = function change(val) {
86
151
  if (!format || !val) {
87
152
  onChange === null || onChange === void 0 ? void 0 : onChange(val);
@@ -90,26 +155,37 @@ var HRangePicker = function HRangePicker(_ref) {
90
155
  var subVal = _mapInstanceProperty(val).call(val, function (item) {
91
156
  return item === null || item === void 0 ? void 0 : item.format(format);
92
157
  });
93
- onChange === null || onChange === void 0 ? void 0 : onChange(paramsProvider(subVal));
158
+ onChange === null || onChange === void 0
159
+ ? void 0
160
+ : onChange(paramsProvider(subVal));
94
161
  };
95
- return /*#__PURE__*/React.createElement(RangePicker, _extends({
96
- value: timeVal,
97
- onChange: change,
98
- showTime: showTime,
99
- ranges: defaultRanges
100
- }, props));
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
+ );
101
174
  };
102
175
  var Index = HFormConnect(HRangePicker);
103
176
  var HRangePicker$1 = {
104
177
  Component: Index,
105
178
  placeholder: function placeholder(_ref3) {
106
179
  var label = _ref3.label;
107
- return ["\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label), "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label)];
180
+ return [
181
+ "\u8BF7\u9009\u62E9\u5F00\u59CB".concat(label),
182
+ "\u8BF7\u9009\u62E9\u7ED3\u675F".concat(label),
183
+ ];
108
184
  },
109
185
  requiredErrMsg: function requiredErrMsg(_ref4) {
110
186
  var label = _ref4.label;
111
187
  return "\u8BF7\u9009\u62E9".concat(label);
112
- }
188
+ },
113
189
  };
114
190
 
115
191
  export { HRangePicker$1 as default };
@@ -1,4 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import type { HTimePickerProps } from "./modal";
3
- declare const _default: ({ value, format, onChange, ...props }: HTimePickerProps) => JSX.Element;
3
+ declare const _default: ({
4
+ value,
5
+ format,
6
+ onChange,
7
+ ...props
8
+ }: HTimePickerProps) => JSX.Element;
4
9
  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,18 +14,24 @@ 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(TimePicker, _extends({
25
- value: timeVal,
26
- onChange: change
27
- }, props));
28
- });
24
+ return /*#__PURE__*/ React.createElement(
25
+ TimePicker,
26
+ _extends(
27
+ {
28
+ value: timeVal,
29
+ onChange: change,
30
+ },
31
+ props
32
+ )
33
+ );
34
+ };
29
35
 
30
36
  export { HTimePicker as default };
31
37
  // powered by hdj
@@ -2,32 +2,52 @@ 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
- 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;
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;
33
53
  export {};
@@ -1,19 +1,22 @@
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(function () {
12
- if (!value || !format) {
13
- return value;
14
- }
15
- return moment(value, format);
16
- }, [value, format]);
11
+ return useMemo(
12
+ function () {
13
+ if (!value || !format) {
14
+ return value;
15
+ }
16
+ return moment(value, format);
17
+ },
18
+ [value, format]
19
+ );
17
20
  };
18
21
  var useGetTimeKey = function useGetTimeKey(_ref2) {
19
22
  var _ref2$valueMap = _ref2.valueMap,
@@ -29,57 +32,72 @@ var useGetTimeKey = function useGetTimeKey(_ref2) {
29
32
  var endKey = typeof end === "string" ? end : end(name);
30
33
  return {
31
34
  start: startKey,
32
- end: endKey
35
+ end: endKey,
33
36
  };
34
37
  };
35
38
  var useTimeChange = function useTimeChange(_ref3) {
36
39
  var format = _ref3.format,
37
40
  onChange = _ref3.onChange;
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]);
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
+ );
46
53
  };
47
54
  var formatMap = {
48
55
  X: "s",
49
- x: "ms"
56
+ x: "ms",
50
57
  };
51
58
  var useTimePickerValue = function useTimePickerValue(_ref4) {
52
59
  var value = _ref4.value,
53
60
  format = _ref4.format;
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]);
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
+ );
64
77
  };
65
78
  var useTimePickerChange = function useTimePickerChange(_ref5) {
66
79
  var value = _ref5.value,
67
80
  format = _ref5.format,
68
81
  onChange = _ref5.onChange;
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]);
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
+ );
83
101
  };
84
102
  var useRangeValueProvider = function useRangeValueProvider(_ref6) {
85
103
  var _ref6$valueMap = _ref6.valueMap,
@@ -91,7 +109,12 @@ var useRangeValueProvider = function useRangeValueProvider(_ref6) {
91
109
  if (!start || !end) {
92
110
  return val;
93
111
  }
94
- return _ref7 = {}, _defineProperty(_ref7, start, val[0]), _defineProperty(_ref7, end, val[1]), _ref7;
112
+ return (
113
+ (_ref7 = {}),
114
+ _defineProperty(_ref7, start, val[0]),
115
+ _defineProperty(_ref7, end, val[1]),
116
+ _ref7
117
+ );
95
118
  };
96
119
  };
97
120
  var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
@@ -99,34 +122,45 @@ var useRangePickerTimeVal = function useRangePickerTimeVal(_ref8) {
99
122
  format = _ref8.format,
100
123
  _ref8$valueMap = _ref8.valueMap,
101
124
  valueMap = _ref8$valueMap === void 0 ? {} : _ref8$valueMap;
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;
125
+ return useMemo(
126
+ function () {
127
+ if (!value || !format) {
128
+ return value;
112
129
  }
113
- var startTime = value[start],
114
- endTime = value[end];
115
- if (!startTime && !endTime) {
116
- return [];
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];
117
145
  }
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]);
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
+ );
129
155
  };
130
156
 
131
- export { useGetTimeKey, useRangePickerTimeVal, useRangeValueProvider, useTimeChange, useTimePickerChange, useTimePickerValue, useTimeVal };
157
+ export {
158
+ useGetTimeKey,
159
+ useRangePickerTimeVal,
160
+ useRangeValueProvider,
161
+ useTimeChange,
162
+ useTimePickerChange,
163
+ useTimePickerValue,
164
+ useTimeVal,
165
+ };
132
166
  // powered by hdj
@@ -1,4 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import type { HDatePickerProps } from "./modal";
3
- declare const _default: ({ value, onChange, showTime, format, ...props }: HDatePickerProps) => JSX.Element;
3
+ declare const _default: ({
4
+ value,
5
+ onChange,
6
+ showTime,
7
+ format,
8
+ ...props
9
+ }: HDatePickerProps) => JSX.Element;
4
10
  export default _default;