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