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