@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.
- package/es/CheckboxGroup/CheckBox/index.js +24 -16
- package/es/CheckboxGroup/hooks.d.ts +9 -3
- package/es/CheckboxGroup/hooks.js +115 -64
- package/es/CheckboxGroup/index.d.ts +6 -1
- package/es/CheckboxGroup/index.js +117 -56
- package/es/CheckboxGroup/modal.d.ts +9 -8
- package/es/Form/Context/FormConfigProvider.js +64 -19
- package/es/Form/Context/index.d.ts +4 -1
- package/es/Form/Context/index.js +3 -3
- package/es/Form/FormItem/BasicItem.js +80 -42
- package/es/Form/FormItem/Helper.d.ts +1 -1
- package/es/Form/FormItem/Helper.js +17 -9
- package/es/Form/FormItem/RegularFormItem.js +11 -8
- package/es/Form/FormItem/UpFormItem.d.ts +6 -1
- package/es/Form/FormItem/UpFormItem.js +27 -17
- package/es/Form/FormItem/hooks.d.ts +21 -4
- package/es/Form/FormItem/hooks.js +12 -9
- package/es/Form/FormItem/index.js +5 -5
- package/es/Form/HFormConnect.d.ts +9 -1
- package/es/Form/HFormConnect.js +94 -26
- package/es/Form/InitSet.d.ts +1 -1
- package/es/Form/InitSet.js +5 -5
- package/es/Form/Label.d.ts +4 -4
- package/es/Form/Label.js +36 -19
- package/es/Form/config.d.ts +100 -22
- package/es/Form/config.js +19 -19
- package/es/Form/hooks/index.d.ts +12 -5
- package/es/Form/hooks/index.js +65 -49
- package/es/Form/hooks/useHForm.js +233 -95
- package/es/Form/hooks/useInitConfigData.d.ts +4 -1
- package/es/Form/hooks/useInitConfigData.js +143 -61
- package/es/Form/index.d.ts +11 -1
- package/es/Form/index.js +71 -40
- package/es/Form/modal.d.ts +92 -51
- package/es/Input/ButtonInput.js +73 -51
- package/es/Input/InputNumber.js +21 -12
- package/es/Input/SelectInput.d.ts +16 -4
- package/es/Input/SelectInput.js +113 -56
- package/es/Input/defaultConfig.d.ts +3 -3
- package/es/Input/defaultConfig.js +2 -2
- package/es/Input/index.js +7 -7
- package/es/Input/modal.d.ts +15 -11
- package/es/PageHandler/ErrorComponent.js +47 -25
- package/es/PageHandler/LoadingComponent.js +17 -13
- package/es/PageHandler/index.js +7 -7
- package/es/PageHandler/modal.d.ts +4 -4
- package/es/RadioGroup/index.d.ts +12 -5
- package/es/RadioGroup/index.js +46 -33
- package/es/Select/components/AllSelect.d.ts +1 -1
- package/es/Select/components/AllSelect.js +40 -18
- package/es/Select/components/CheckBoxOption.d.ts +6 -3
- package/es/Select/components/CheckBoxOption.js +12 -7
- package/es/Select/components/DropdownComponent.d.ts +4 -4
- package/es/Select/components/DropdownComponent.js +30 -17
- package/es/Select/components/NoFindItem.d.ts +1 -1
- package/es/Select/components/NoFindItem.js +11 -7
- package/es/Select/components/NotFoundContent.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +49 -27
- package/es/Select/defaultConfig.d.ts +1 -1
- package/es/Select/defaultConfig.js +20 -16
- package/es/Select/hooks/changeHooks.d.ts +2 -2
- package/es/Select/hooks/changeHooks.js +147 -71
- package/es/Select/hooks/norHooks.d.ts +27 -9
- package/es/Select/hooks/norHooks.js +51 -39
- package/es/Select/index.d.ts +22 -1
- package/es/Select/index.js +124 -65
- package/es/Select/modal.d.ts +15 -15
- package/es/Select/utils.js +60 -15
- package/es/Submit/index.d.ts +9 -3
- package/es/Submit/index.js +18 -13
- package/es/Switch/index.d.ts +4 -4
- package/es/Switch/index.js +46 -20
- package/es/TDPicker/RangePicker.d.ts +8 -3
- package/es/TDPicker/RangePicker.js +138 -62
- package/es/TDPicker/TimePicker.d.ts +6 -1
- package/es/TDPicker/TimePicker.js +19 -13
- package/es/TDPicker/hooks.d.ts +42 -22
- package/es/TDPicker/hooks.js +106 -72
- package/es/TDPicker/index.d.ts +7 -1
- package/es/TDPicker/index.js +20 -14
- package/es/TDPicker/modal.d.ts +21 -16
- package/es/Upload/Btn.d.ts +5 -1
- package/es/Upload/Btn.js +35 -19
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
- package/es/Upload/MediaTypeEle/TypeEle.js +31 -23
- package/es/Upload/MediaTypeEle/index.d.ts +5 -1
- package/es/Upload/MediaTypeEle/index.js +21 -18
- package/es/Upload/Preview/index.d.ts +5 -1
- package/es/Upload/Preview/index.js +17 -13
- package/es/Upload/UrlUpload/index.d.ts +7 -1
- package/es/Upload/UrlUpload/index.js +72 -51
- package/es/Upload/enums.d.ts +3 -3
- package/es/Upload/enums.js +3 -3
- package/es/Upload/hooks/change.d.ts +8 -1
- package/es/Upload/hooks/change.js +115 -58
- package/es/Upload/hooks/customRequest.d.ts +5 -1
- package/es/Upload/hooks/customRequest.js +63 -46
- package/es/Upload/hooks/propsMaker.d.ts +5 -1
- package/es/Upload/hooks/propsMaker.js +52 -13
- package/es/Upload/index.d.ts +3 -1
- package/es/Upload/index.js +131 -61
- package/es/Upload/modal.d.ts +17 -15
- package/es/Upload/util.d.ts +8 -2
- package/es/Upload/util.js +15 -7
- package/es/config.js +34 -31
- package/es/hooks/index.d.ts +14 -7
- package/es/hooks/index.js +124 -49
- package/es/index.d.ts +98 -16
- package/es/index.js +22 -5
- package/es/modal.d.ts +6 -6
- package/lib/CheckboxGroup/CheckBox/index.js +26 -18
- package/lib/CheckboxGroup/hooks.d.ts +9 -3
- package/lib/CheckboxGroup/hooks.js +116 -65
- package/lib/CheckboxGroup/index.d.ts +6 -1
- package/lib/CheckboxGroup/index.js +119 -58
- package/lib/CheckboxGroup/modal.d.ts +9 -8
- package/lib/Form/Context/FormConfigProvider.js +66 -21
- package/lib/Form/Context/index.d.ts +4 -1
- package/lib/Form/Context/index.js +4 -4
- package/lib/Form/FormItem/BasicItem.js +82 -44
- package/lib/Form/FormItem/Helper.d.ts +1 -1
- package/lib/Form/FormItem/Helper.js +19 -11
- package/lib/Form/FormItem/RegularFormItem.js +13 -10
- package/lib/Form/FormItem/UpFormItem.d.ts +6 -1
- package/lib/Form/FormItem/UpFormItem.js +29 -19
- package/lib/Form/FormItem/hooks.d.ts +21 -4
- package/lib/Form/FormItem/hooks.js +13 -10
- package/lib/Form/FormItem/index.js +7 -7
- package/lib/Form/HFormConnect.d.ts +9 -1
- package/lib/Form/HFormConnect.js +96 -28
- package/lib/Form/InitSet.d.ts +1 -1
- package/lib/Form/InitSet.js +7 -7
- package/lib/Form/Label.d.ts +4 -4
- package/lib/Form/Label.js +41 -21
- package/lib/Form/config.d.ts +100 -22
- package/lib/Form/config.js +21 -21
- package/lib/Form/hooks/index.d.ts +12 -5
- package/lib/Form/hooks/index.js +66 -50
- package/lib/Form/hooks/useHForm.js +235 -97
- package/lib/Form/hooks/useInitConfigData.d.ts +4 -1
- package/lib/Form/hooks/useInitConfigData.js +144 -63
- package/lib/Form/index.d.ts +11 -1
- package/lib/Form/index.js +73 -42
- package/lib/Form/modal.d.ts +92 -51
- package/lib/Input/ButtonInput.js +75 -53
- package/lib/Input/InputNumber.js +23 -14
- package/lib/Input/SelectInput.d.ts +16 -4
- package/lib/Input/SelectInput.js +125 -60
- package/lib/Input/defaultConfig.d.ts +3 -3
- package/lib/Input/defaultConfig.js +3 -3
- package/lib/Input/index.js +9 -9
- package/lib/Input/modal.d.ts +15 -11
- package/lib/PageHandler/ErrorComponent.js +49 -27
- package/lib/PageHandler/LoadingComponent.js +19 -15
- package/lib/PageHandler/index.js +9 -9
- package/lib/PageHandler/modal.d.ts +4 -4
- package/lib/RadioGroup/index.d.ts +12 -5
- package/lib/RadioGroup/index.js +48 -35
- package/lib/Select/components/AllSelect.d.ts +1 -1
- package/lib/Select/components/AllSelect.js +42 -20
- package/lib/Select/components/CheckBoxOption.d.ts +6 -3
- package/lib/Select/components/CheckBoxOption.js +14 -9
- package/lib/Select/components/DropdownComponent.d.ts +4 -4
- package/lib/Select/components/DropdownComponent.js +32 -19
- package/lib/Select/components/NoFindItem.d.ts +1 -1
- package/lib/Select/components/NoFindItem.js +13 -9
- package/lib/Select/components/NotFoundContent.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +51 -29
- package/lib/Select/defaultConfig.d.ts +1 -1
- package/lib/Select/defaultConfig.js +21 -17
- package/lib/Select/hooks/changeHooks.d.ts +2 -2
- package/lib/Select/hooks/changeHooks.js +148 -72
- package/lib/Select/hooks/norHooks.d.ts +27 -9
- package/lib/Select/hooks/norHooks.js +52 -40
- package/lib/Select/index.d.ts +22 -1
- package/lib/Select/index.js +128 -67
- package/lib/Select/modal.d.ts +15 -15
- package/lib/Select/utils.js +61 -16
- package/lib/Submit/index.d.ts +9 -3
- package/lib/Submit/index.js +20 -15
- package/lib/Switch/index.d.ts +4 -4
- package/lib/Switch/index.js +48 -22
- package/lib/TDPicker/RangePicker.d.ts +8 -3
- package/lib/TDPicker/RangePicker.js +136 -64
- package/lib/TDPicker/TimePicker.d.ts +6 -1
- package/lib/TDPicker/TimePicker.js +21 -15
- package/lib/TDPicker/hooks.d.ts +42 -22
- package/lib/TDPicker/hooks.js +98 -72
- package/lib/TDPicker/index.d.ts +7 -1
- package/lib/TDPicker/index.js +22 -16
- package/lib/TDPicker/modal.d.ts +21 -16
- package/lib/Upload/Btn.d.ts +5 -1
- package/lib/Upload/Btn.js +37 -21
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
- package/lib/Upload/MediaTypeEle/TypeEle.js +33 -25
- package/lib/Upload/MediaTypeEle/index.d.ts +5 -1
- package/lib/Upload/MediaTypeEle/index.js +23 -20
- package/lib/Upload/Preview/index.d.ts +5 -1
- package/lib/Upload/Preview/index.js +19 -15
- package/lib/Upload/UrlUpload/index.d.ts +7 -1
- package/lib/Upload/UrlUpload/index.js +74 -53
- package/lib/Upload/enums.d.ts +3 -3
- package/lib/Upload/enums.js +4 -4
- package/lib/Upload/hooks/change.d.ts +8 -1
- package/lib/Upload/hooks/change.js +116 -59
- package/lib/Upload/hooks/customRequest.d.ts +5 -1
- package/lib/Upload/hooks/customRequest.js +64 -47
- package/lib/Upload/hooks/propsMaker.d.ts +5 -1
- package/lib/Upload/hooks/propsMaker.js +55 -15
- package/lib/Upload/index.d.ts +3 -1
- package/lib/Upload/index.js +133 -63
- package/lib/Upload/modal.d.ts +17 -15
- package/lib/Upload/util.d.ts +8 -2
- package/lib/Upload/util.js +16 -8
- package/lib/config.js +35 -32
- package/lib/hooks/index.d.ts +14 -7
- package/lib/hooks/index.js +125 -50
- package/lib/index.d.ts +98 -16
- package/lib/index.js +5 -5
- package/lib/modal.d.ts +6 -6
- package/package.json +2 -2
- package/src/components/CheckboxGroup/index.tsx +2 -2
- package/src/components/Form/FormItem/Helper.tsx +3 -4
- package/src/components/Form/HFormConnect.tsx +6 -2
- package/src/components/Form/hooks/useHForm.ts +59 -10
- package/src/components/Form/modal.ts +12 -8
- package/src/components/TDPicker/RangePicker.tsx +7 -5
- package/src/components/TDPicker/modal.ts +1 -0
- 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
|
|
3
|
-
import _extends from
|
|
4
|
-
import _objectWithoutProperties from
|
|
5
|
-
import _mapInstanceProperty from
|
|
6
|
-
import { Form } from
|
|
7
|
-
import Item from
|
|
8
|
-
import { useCurrentForm, useSub, useInit } from
|
|
9
|
-
import { FormContext } from
|
|
10
|
-
import Index from
|
|
11
|
-
import useInitConfigData from
|
|
12
|
-
import InitSet from
|
|
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 = [
|
|
15
|
-
|
|
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(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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 {
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
19
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
73
|
+
required?: boolean;
|
|
45
74
|
}
|
|
46
75
|
export interface FormItemWithRender extends Omit<HFormItemProps, "render"> {
|
|
47
|
-
|
|
76
|
+
render: (form: HFormInstance) => React.ReactNode;
|
|
48
77
|
}
|
|
78
|
+
export type argsFn = (...args: any[]) => void;
|
|
49
79
|
export interface FormContextProps {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
80
|
+
loading?: boolean;
|
|
81
|
+
form: HFormInstance;
|
|
82
|
+
valueType?: string;
|
|
53
83
|
}
|
|
54
84
|
interface ConfigUploadProps {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
85
|
+
exFiles?: string[];
|
|
86
|
+
maxSize?: number;
|
|
87
|
+
request?: PromiseFnResult;
|
|
58
88
|
}
|
|
59
89
|
export interface IFormConfigContextProps {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
114
|
+
format?: Record<string, addFormatItemModal>;
|
|
78
115
|
}
|
|
79
116
|
type ValueFormat = (value: Record<string, any>) => Record<string, any>;
|
|
80
117
|
export interface FormatItemModal {
|
|
81
|
-
|
|
82
|
-
|
|
118
|
+
inputValue: ValueFormat;
|
|
119
|
+
outputValue: ValueFormat;
|
|
83
120
|
}
|
|
84
|
-
type addValueFormat = (
|
|
121
|
+
type addValueFormat = (
|
|
122
|
+
item: HFormItemProps,
|
|
123
|
+
value: Record<string, any>
|
|
124
|
+
) => Record<string, any>;
|
|
85
125
|
export interface addFormatItemModal {
|
|
86
|
-
|
|
87
|
-
|
|
126
|
+
inputValue: addValueFormat;
|
|
127
|
+
outputValue: addValueFormat;
|
|
88
128
|
}
|
|
89
129
|
export interface ConnectResultProps {
|
|
90
|
-
|
|
130
|
+
addFormat?: (format: Record<string, addFormatItemModal>) => void;
|
|
131
|
+
addDispatchListener?: (key: string, fn: argsFn) => void;
|
|
91
132
|
}
|
|
92
133
|
export {};
|
package/es/Input/ButtonInput.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _extends from
|
|
3
|
-
import _asyncToGenerator from
|
|
4
|
-
import _objectWithoutProperties from
|
|
5
|
-
import _regeneratorRuntime from
|
|
6
|
-
import { Input, Button } from
|
|
7
|
-
import React from
|
|
8
|
-
import { useRequest } from
|
|
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(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
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(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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 };
|
package/es/Input/InputNumber.js
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React from
|
|
3
|
-
import _extends from
|
|
4
|
-
import _objectWithoutProperties from
|
|
5
|
-
import { InputNumber } from
|
|
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 =
|
|
8
|
+
var HInputNumber = function (_ref) {
|
|
9
9
|
var _ref$style = _ref.style,
|
|
10
|
-
style =
|
|
11
|
-
|
|
12
|
-
|
|
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(
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
5
|
-
|
|
4
|
+
input = 0,
|
|
5
|
+
select = 1,
|
|
6
6
|
}
|
|
7
|
-
export declare const Index: ({
|
|
8
|
-
|
|
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;
|