@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,7 +1,7 @@
1
1
  // welcome to hoo hoo hoo
2
- import { Checkbox } from "antd";
3
- import React, { useMemo } from "react";
4
- import { useMatchConfigProps } from "../../hooks/index.js";
2
+ import { Checkbox } from 'antd';
3
+ import React, { useMemo } from 'react';
4
+ import { useMatchConfigProps } from '../../hooks/index.js';
5
5
 
6
6
  var Index = function Index(_ref) {
7
7
  var value = _ref.value,
@@ -9,21 +9,17 @@ var Index = function Index(_ref) {
9
9
  children = _ref.children,
10
10
  propsValueCheckMap = _ref.valueMap;
11
11
  var _useMatchConfigProps = useMatchConfigProps({
12
- valueCheckMap: propsValueCheckMap,
12
+ valueCheckMap: propsValueCheckMap
13
13
  }),
14
14
  _useMatchConfigProps$ = _useMatchConfigProps.valueCheckMap,
15
- valueCheckMap =
16
- _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
17
- var checkedVal = useMemo(
18
- function () {
19
- var checked = valueCheckMap.checked;
20
- if (value === checked) {
21
- return true;
22
- }
23
- return false;
24
- },
25
- [value]
26
- );
15
+ valueCheckMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
16
+ var checkedVal = useMemo(function () {
17
+ var checked = valueCheckMap.checked;
18
+ if (value === checked) {
19
+ return true;
20
+ }
21
+ return false;
22
+ }, [value]);
27
23
  var change = function change(e) {
28
24
  var checked = valueCheckMap.checked,
29
25
  noChecked = valueCheckMap.noChecked;
@@ -34,14 +30,10 @@ var Index = function Index(_ref) {
34
30
  }
35
31
  onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
36
32
  };
37
- return /*#__PURE__*/ React.createElement(
38
- Checkbox,
39
- {
40
- checked: checkedVal,
41
- onChange: change,
42
- },
43
- children
44
- );
33
+ return /*#__PURE__*/React.createElement(Checkbox, {
34
+ checked: checkedVal,
35
+ onChange: change
36
+ }, children);
45
37
  };
46
38
 
47
39
  export { Index as default };
@@ -1,11 +1,5 @@
1
1
  import type { HCheckboxProps } from "@/components/CheckboxGroup/modal";
2
- export declare const useValueProvider: ({
3
- value,
4
- valueMap,
5
- keyInValue,
6
- onChange,
7
- options,
8
- }: HCheckboxProps) => {
9
- val: Record<any, any>;
10
- change: (key: any, changeVal: any) => void;
2
+ export declare const useValueProvider: ({ value, valueMap, keyInValue, onChange, options, }: HCheckboxProps) => {
3
+ val: Record<any, any>;
4
+ change: (key: any, changeVal: any) => void;
11
5
  };
@@ -1,57 +1,19 @@
1
1
  // welcome to hoo hoo hoo
2
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js/object/get-own-property-symbols";
3
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
4
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptors";
5
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js/object/define-properties";
6
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
7
- import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
8
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
9
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
10
- import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
11
- import _Array$isArray from "@babel/runtime-corejs3/core-js/array/is-array";
12
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
13
- import { useState, useMemo, useEffect } from "react";
2
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
3
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
4
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
5
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
6
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
7
+ import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
8
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
9
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
10
+ import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
11
+ import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
12
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
13
+ import { useState, useMemo, useEffect } from 'react';
14
14
 
15
- function ownKeys(object, enumerableOnly) {
16
- var keys = _Object$keys(object);
17
- if (_Object$getOwnPropertySymbols) {
18
- var symbols = _Object$getOwnPropertySymbols(object);
19
- enumerableOnly &&
20
- (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
21
- return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
22
- })),
23
- keys.push.apply(keys, symbols);
24
- }
25
- return keys;
26
- }
27
- function _objectSpread(target) {
28
- for (var i = 1; i < arguments.length; i++) {
29
- var _context2, _context3;
30
- var source = null != arguments[i] ? arguments[i] : {};
31
- i % 2
32
- ? _forEachInstanceProperty(
33
- (_context2 = ownKeys(Object(source), !0))
34
- ).call(_context2, function (key) {
35
- _defineProperty(target, key, source[key]);
36
- })
37
- : _Object$getOwnPropertyDescriptors
38
- ? _Object$defineProperties(
39
- target,
40
- _Object$getOwnPropertyDescriptors(source)
41
- )
42
- : _forEachInstanceProperty((_context3 = ownKeys(Object(source)))).call(
43
- _context3,
44
- function (key) {
45
- _Object$defineProperty(
46
- target,
47
- key,
48
- _Object$getOwnPropertyDescriptor(source, key)
49
- );
50
- }
51
- );
52
- }
53
- return target;
54
- }
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 _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; }
55
17
  var changValProvider = function changValProvider(_ref) {
56
18
  var value = _ref.value,
57
19
  options = _ref.options,
@@ -60,14 +22,12 @@ var changValProvider = function changValProvider(_ref) {
60
22
  var newVal = _objectSpread({}, value);
61
23
  var checked = valueMap.checked,
62
24
  noChecked = valueMap.noChecked;
63
- options === null || options === void 0
64
- ? void 0
65
- : _forEachInstanceProperty(options).call(options, function (item) {
66
- var itemVal = item.value;
67
- if (newVal[itemVal] !== checked) {
68
- newVal[itemVal] = noChecked;
69
- }
70
- });
25
+ options === null || options === void 0 ? void 0 : _forEachInstanceProperty(options).call(options, function (item) {
26
+ var itemVal = item.value;
27
+ if (newVal[itemVal] !== checked) {
28
+ newVal[itemVal] = noChecked;
29
+ }
30
+ });
71
31
  return newVal;
72
32
  };
73
33
  var useValueProvider = function useValueProvider(_ref2) {
@@ -84,62 +44,53 @@ var useValueProvider = function useValueProvider(_ref2) {
84
44
  setVal = _useState2[1];
85
45
  var oldValueCheckMap = useMemo(function () {
86
46
  return {
87
- valueMap: valueMap,
47
+ valueMap: valueMap
88
48
  };
89
49
  }, []);
90
- useEffect(
91
- function () {
92
- setVal(function (oldVal) {
93
- return changValProvider({
94
- value: oldVal,
95
- options: options,
96
- valueMap: oldValueCheckMap.valueMap,
97
- });
50
+ useEffect(function () {
51
+ setVal(function (oldVal) {
52
+ return changValProvider({
53
+ value: oldVal,
54
+ options: options,
55
+ valueMap: oldValueCheckMap.valueMap
98
56
  });
99
- },
100
- [options]
101
- );
102
- useEffect(
103
- function () {
104
- var oldChecked = oldValueCheckMap.valueMap.checked;
105
- var checked = valueMap.checked,
106
- noChecked = valueMap.noChecked;
107
- setVal(function (oldVal) {
108
- var newVal = _objectSpread({}, oldVal);
109
- var keys = _Object$keys(newVal);
110
- _forEachInstanceProperty(keys).call(keys, function (key) {
111
- if (newVal[key] === oldChecked) {
112
- newVal[key] = checked;
113
- return;
114
- }
115
- newVal[key] = noChecked;
116
- });
117
- oldValueCheckMap.valueMap = valueMap;
118
- return newVal;
57
+ });
58
+ }, [options]);
59
+ useEffect(function () {
60
+ var oldChecked = oldValueCheckMap.valueMap.checked;
61
+ var checked = valueMap.checked,
62
+ noChecked = valueMap.noChecked;
63
+ setVal(function (oldVal) {
64
+ var newVal = _objectSpread({}, oldVal);
65
+ var keys = _Object$keys(newVal);
66
+ _forEachInstanceProperty(keys).call(keys, function (key) {
67
+ if (newVal[key] === oldChecked) {
68
+ newVal[key] = checked;
69
+ return;
70
+ }
71
+ newVal[key] = noChecked;
119
72
  });
120
- },
121
- [valueMap]
122
- );
123
- useEffect(
124
- function () {
125
- var checked = oldValueCheckMap.valueMap.checked;
126
- if (!value) {
127
- return;
128
- }
129
- if (!_Array$isArray(value)) {
130
- setVal(value);
131
- return;
132
- }
133
- setVal(function (oldVal) {
134
- var newVal = _objectSpread({}, oldVal);
135
- _forEachInstanceProperty(value).call(value, function (itemVal) {
136
- newVal[itemVal] = checked;
137
- });
138
- return newVal;
73
+ oldValueCheckMap.valueMap = valueMap;
74
+ return newVal;
75
+ });
76
+ }, [valueMap]);
77
+ useEffect(function () {
78
+ var checked = oldValueCheckMap.valueMap.checked;
79
+ if (!value) {
80
+ return;
81
+ }
82
+ if (!_Array$isArray(value)) {
83
+ setVal(value);
84
+ return;
85
+ }
86
+ setVal(function (oldVal) {
87
+ var newVal = _objectSpread({}, oldVal);
88
+ _forEachInstanceProperty(value).call(value, function (itemVal) {
89
+ newVal[itemVal] = checked;
139
90
  });
140
- },
141
- [value]
142
- );
91
+ return newVal;
92
+ });
93
+ }, [value]);
143
94
  var change = function change(key, changeVal) {
144
95
  var _context;
145
96
  var checked = valueMap.checked,
@@ -157,16 +108,14 @@ var useValueProvider = function useValueProvider(_ref2) {
157
108
  onChange(newVal);
158
109
  return;
159
110
  }
160
- var subVal = _filterInstanceProperty(
161
- (_context = _Object$keys(newVal))
162
- ).call(_context, function (valKey) {
111
+ var subVal = _filterInstanceProperty(_context = _Object$keys(newVal)).call(_context, function (valKey) {
163
112
  return newVal[valKey] === checked;
164
113
  });
165
114
  onChange(subVal);
166
115
  };
167
116
  return {
168
117
  val: val,
169
- change: change,
118
+ change: change
170
119
  };
171
120
  };
172
121
 
@@ -1,8 +1,3 @@
1
1
  import React from "react";
2
- declare const _default: (
3
- props: import("../Form/modal").HFormItemProps
4
- ) => React.ReactElement<
5
- import("../Form/modal").ConnectResultProps,
6
- string | React.JSXElementConstructor<any>
7
- >;
2
+ declare const _default: (props: import("../Form/modal").HFormItemProps) => React.ReactElement<import("../Form/modal").ConnectResultProps, string | React.JSXElementConstructor<any>>;
8
3
  export default _default;
@@ -1,62 +1,23 @@
1
1
  // welcome to hoo hoo hoo
2
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
3
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
4
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
5
- import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
6
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js/object/get-own-property-symbols";
7
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
8
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
9
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptors";
10
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js/object/define-properties";
11
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
12
- import { Space } from "antd";
13
- import { useValueProvider } from "./hooks.js";
14
- import Index$1 from "./CheckBox/index.js";
15
- import { useMatchConfigProps, useChangeOptions } from "../hooks/index.js";
16
- import HFormConnect from "../Form/HFormConnect.js";
17
- import React from "react";
2
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
4
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
5
+ import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
6
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
7
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
8
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
9
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
10
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
11
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
12
+ import { Space } from 'antd';
13
+ import { useValueProvider } from './hooks.js';
14
+ import Index$1 from './CheckBox/index.js';
15
+ import { useMatchConfigProps, useChangeOptions } from '../hooks/index.js';
16
+ import HFormConnect from '../Form/HFormConnect.js';
17
+ import React from 'react';
18
18
 
19
- function ownKeys(object, enumerableOnly) {
20
- var keys = _Object$keys(object);
21
- if (_Object$getOwnPropertySymbols) {
22
- var symbols = _Object$getOwnPropertySymbols(object);
23
- enumerableOnly &&
24
- (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
25
- return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
26
- })),
27
- keys.push.apply(keys, symbols);
28
- }
29
- return keys;
30
- }
31
- function _objectSpread(target) {
32
- for (var i = 1; i < arguments.length; i++) {
33
- var _context, _context2;
34
- var source = null != arguments[i] ? arguments[i] : {};
35
- i % 2
36
- ? _forEachInstanceProperty((_context = ownKeys(Object(source), !0))).call(
37
- _context,
38
- function (key) {
39
- _defineProperty(target, key, source[key]);
40
- }
41
- )
42
- : _Object$getOwnPropertyDescriptors
43
- ? _Object$defineProperties(
44
- target,
45
- _Object$getOwnPropertyDescriptors(source)
46
- )
47
- : _forEachInstanceProperty((_context2 = ownKeys(Object(source)))).call(
48
- _context2,
49
- function (key) {
50
- _Object$defineProperty(
51
- target,
52
- key,
53
- _Object$getOwnPropertyDescriptor(source, key)
54
- );
55
- }
56
- );
57
- }
58
- return target;
59
- }
19
+ 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; }
20
+ 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; }
60
21
  var Index = function Index(_ref) {
61
22
  var options = _ref.options,
62
23
  fieldNames = _ref.fieldNames,
@@ -69,80 +30,60 @@ var Index = function Index(_ref) {
69
30
  addFormat = _ref.addFormat;
70
31
  var _useMatchConfigProps = useMatchConfigProps({
71
32
  fieldNames: fieldNames,
72
- valueCheckMap: valueMap,
33
+ valueCheckMap: valueMap
73
34
  }),
74
35
  resultValueCheckMap = _useMatchConfigProps.valueCheckMap,
75
36
  resultFieldNames = _useMatchConfigProps.fieldNames;
76
37
  var checkOptions = useChangeOptions({
77
38
  options: options,
78
- fieldNames: resultFieldNames,
39
+ fieldNames: resultFieldNames
79
40
  });
80
41
  var _useValueProvider = useValueProvider({
81
42
  options: checkOptions,
82
43
  onChange: onChange,
83
44
  valueMap: resultValueCheckMap,
84
45
  keyInValue: keyInValue,
85
- value: value,
46
+ value: value
86
47
  }),
87
48
  val = _useValueProvider.val,
88
49
  change = _useValueProvider.change;
89
- addFormat === null || addFormat === void 0
90
- ? void 0
91
- : addFormat({
92
- float: {
93
- inputValue: function inputValue(item, initValue) {
94
- var _item$name = item.name,
95
- name = _item$name === void 0 ? "" : _item$name;
96
- var keys =
97
- checkOptions === null || checkOptions === void 0
98
- ? void 0
99
- : _mapInstanceProperty(checkOptions).call(
100
- checkOptions,
101
- function (optItem) {
102
- return optItem.value;
103
- }
104
- );
105
- var resultObj = {};
106
- keys === null || keys === void 0
107
- ? void 0
108
- : _forEachInstanceProperty(keys).call(keys, function (key) {
109
- resultObj[key] = initValue[key];
110
- });
111
- return _defineProperty({}, name, resultObj);
112
- },
113
- outputValue: function outputValue(item, _outputValue) {
114
- var _item$name2 = item.name,
115
- name = _item$name2 === void 0 ? "" : _item$name2;
116
- var _outputValue$name = _outputValue[name],
117
- itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
118
- return _objectSpread({}, itemVal);
119
- },
120
- },
121
- });
122
- return /*#__PURE__*/ React.createElement(
123
- Space,
124
- null,
125
- checkOptions === null || checkOptions === void 0
126
- ? void 0
127
- : _mapInstanceProperty(checkOptions).call(checkOptions, function (item) {
128
- var label = item.label,
129
- itemVal = item.value;
130
- var checked = val[itemVal];
131
- return /*#__PURE__*/ React.createElement(
132
- Index$1,
133
- {
134
- value: checked,
135
- key: itemVal,
136
- onChange: function onChange(changeVal) {
137
- change(itemVal, changeVal);
138
- },
139
- valueMap: valueMap,
140
- disabled: disabled,
141
- },
142
- label
143
- );
144
- })
145
- );
50
+ addFormat === null || addFormat === void 0 ? void 0 : addFormat({
51
+ "float": {
52
+ inputValue: function inputValue(item, initValue) {
53
+ var _item$name = item.name,
54
+ name = _item$name === void 0 ? "" : _item$name;
55
+ var keys = checkOptions === null || checkOptions === void 0 ? void 0 : _mapInstanceProperty(checkOptions).call(checkOptions, function (optItem) {
56
+ return optItem.value;
57
+ });
58
+ var resultObj = {};
59
+ keys === null || keys === void 0 ? void 0 : _forEachInstanceProperty(keys).call(keys, function (key) {
60
+ resultObj[key] = initValue[key];
61
+ });
62
+ return _defineProperty({}, name, resultObj);
63
+ },
64
+ outputValue: function outputValue(item, _outputValue) {
65
+ var _item$name2 = item.name,
66
+ name = _item$name2 === void 0 ? "" : _item$name2;
67
+ var _outputValue$name = _outputValue[name],
68
+ itemVal = _outputValue$name === void 0 ? {} : _outputValue$name;
69
+ return _objectSpread({}, itemVal);
70
+ }
71
+ }
72
+ });
73
+ return /*#__PURE__*/React.createElement(Space, null, checkOptions === null || checkOptions === void 0 ? void 0 : _mapInstanceProperty(checkOptions).call(checkOptions, function (item) {
74
+ var label = item.label,
75
+ itemVal = item.value;
76
+ var checked = val[itemVal];
77
+ return /*#__PURE__*/React.createElement(Index$1, {
78
+ value: checked,
79
+ key: itemVal,
80
+ onChange: function onChange(changeVal) {
81
+ change(itemVal, changeVal);
82
+ },
83
+ valueMap: valueMap,
84
+ disabled: disabled
85
+ }, label);
86
+ }));
146
87
  };
147
88
  var HCheckboxGroup = HFormConnect(Index);
148
89
 
@@ -2,13 +2,12 @@ import type { CheckboxProps } from "antd/lib/checkbox/Checkbox";
2
2
  import type { SelectProps } from "antd";
3
3
  import type { addFormatItemModal } from "../Form/modal";
4
4
  import type { ValueCheckMapModal } from "../modal";
5
- export interface HCheckboxProps
6
- extends Omit<CheckboxProps, "value" | "onChange"> {
7
- options?: Record<string, any>[];
8
- fieldNames?: SelectProps["fieldNames"];
9
- valueMap?: ValueCheckMapModal;
10
- keyInValue?: boolean;
11
- value?: Record<string, any> | any[];
12
- onChange?: (value: Record<string, any> | any[]) => void;
13
- addFormat?: (config: Record<string, addFormatItemModal>) => void;
5
+ export interface HCheckboxProps extends Omit<CheckboxProps, "value" | "onChange"> {
6
+ options?: Record<string, any>[];
7
+ fieldNames?: SelectProps["fieldNames"];
8
+ valueMap?: ValueCheckMapModal;
9
+ keyInValue?: boolean;
10
+ value?: Record<string, any> | any[];
11
+ onChange?: (value: Record<string, any> | any[]) => void;
12
+ addFormat?: (config: Record<string, addFormatItemModal>) => void;
14
13
  }
@@ -1,66 +1,25 @@
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 _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
9
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
10
- import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
11
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
12
- import { FormConfigContext } from "./index.js";
13
- import React, { useContext } from "react";
14
- import { baseConfig } from "../../config.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 _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
9
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
10
+ import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
11
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
12
+ import { FormConfigContext } from './index.js';
13
+ import React, { useContext } from 'react';
14
+ import { baseConfig } from '../../config.js';
15
15
 
16
16
  var _excluded = ["children"];
17
- function ownKeys(object, enumerableOnly) {
18
- var keys = _Object$keys(object);
19
- if (_Object$getOwnPropertySymbols) {
20
- var symbols = _Object$getOwnPropertySymbols(object);
21
- enumerableOnly &&
22
- (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
23
- return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
24
- })),
25
- keys.push.apply(keys, symbols);
26
- }
27
- return keys;
28
- }
29
- function _objectSpread(target) {
30
- for (var i = 1; i < arguments.length; i++) {
31
- var _context, _context2;
32
- var source = null != arguments[i] ? arguments[i] : {};
33
- i % 2
34
- ? _forEachInstanceProperty((_context = ownKeys(Object(source), !0))).call(
35
- _context,
36
- function (key) {
37
- _defineProperty(target, key, source[key]);
38
- }
39
- )
40
- : _Object$getOwnPropertyDescriptors
41
- ? _Object$defineProperties(
42
- target,
43
- _Object$getOwnPropertyDescriptors(source)
44
- )
45
- : _forEachInstanceProperty((_context2 = ownKeys(Object(source)))).call(
46
- _context2,
47
- function (key) {
48
- _Object$defineProperty(
49
- target,
50
- key,
51
- _Object$getOwnPropertyDescriptor(source, key)
52
- );
53
- }
54
- );
55
- }
56
- return target;
57
- }
17
+ 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; }
18
+ 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; }
58
19
  var useFormConfigContext = function useFormConfigContext(key) {
59
20
  var defaultProps = useContext(FormConfigContext);
60
21
  if (!key) {
61
- return _Object$keys(defaultProps).length === 0
62
- ? _objectSpread({}, baseConfig)
63
- : defaultProps;
22
+ return _Object$keys(defaultProps).length === 0 ? _objectSpread({}, baseConfig) : defaultProps;
64
23
  }
65
24
  return defaultProps[key] || _objectSpread({}, baseConfig[key]);
66
25
  };
@@ -79,13 +38,9 @@ var mergeProps = function mergeProps(props) {
79
38
  var Index = function Index(_ref) {
80
39
  var children = _ref.children,
81
40
  props = _objectWithoutProperties(_ref, _excluded);
82
- return /*#__PURE__*/ React.createElement(
83
- FormConfigContext.Provider,
84
- {
85
- value: mergeProps(props),
86
- },
87
- children
88
- );
41
+ return /*#__PURE__*/React.createElement(FormConfigContext.Provider, {
42
+ value: mergeProps(props)
43
+ }, children);
89
44
  };
90
45
 
91
46
  export { Index as default, useFormConfigContext };
@@ -1,8 +1,5 @@
1
1
  import React from "react";
2
- import type {
3
- IFormConfigContextProps,
4
- FormContextProps,
5
- } from "@/components/Form/modal";
2
+ import type { IFormConfigContextProps, FormContextProps } from "@/components/Form/modal";
6
3
  export declare const FormContext: React.Context<Partial<FormContextProps>>;
7
4
  export declare const useFormContext: () => FormContextProps;
8
5
  export declare const FormConfigContext: React.Context<IFormConfigContextProps>;