@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.
- 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 +78 -0
- package/es/ModalForm/index.d.ts +4 -0
- package/es/ModalForm/index.js +59 -0
- package/es/ModalForm/modal.d.ts +23 -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 +81 -0
- package/lib/ModalForm/index.d.ts +4 -0
- package/lib/ModalForm/index.js +62 -0
- package/lib/ModalForm/modal.d.ts +23 -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 +61 -0
- package/src/components/ModalForm/index.tsx +52 -0
- package/src/components/ModalForm/modal.ts +25 -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/Context/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React, { useContext } from
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
3
|
|
|
4
|
-
var FormContext = /*#__PURE__*/
|
|
4
|
+
var FormContext = /*#__PURE__*/React.createContext({});
|
|
5
5
|
var useFormContext = function useFormContext() {
|
|
6
6
|
return useContext(FormContext);
|
|
7
7
|
};
|
|
8
|
-
var FormConfigContext = /*#__PURE__*/
|
|
8
|
+
var FormConfigContext = /*#__PURE__*/React.createContext({});
|
|
9
9
|
|
|
10
10
|
export { FormConfigContext, FormContext, useFormContext };
|
|
11
11
|
// powered by hdj
|
|
@@ -1,58 +1,36 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _extends from
|
|
3
|
-
import _objectWithoutProperties from
|
|
4
|
-
import Index$1 from
|
|
5
|
-
import { Form, Space } from
|
|
6
|
-
import React from
|
|
7
|
-
import Index$2 from
|
|
8
|
-
import { useClassName } from
|
|
9
|
-
import { useHide } from
|
|
10
|
-
import { useFormContext } from
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import Index$1 from '../Label.js';
|
|
5
|
+
import { Form, Space } from 'antd';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import Index$2 from './Helper.js';
|
|
8
|
+
import { useClassName } from '../../hooks/index.js';
|
|
9
|
+
import { useHide } from './hooks.js';
|
|
10
|
+
import { useFormContext } from '../Context/index.js';
|
|
11
11
|
|
|
12
|
-
var _excluded = [
|
|
13
|
-
"hover",
|
|
14
|
-
"labelWidth",
|
|
15
|
-
"required",
|
|
16
|
-
"colon",
|
|
17
|
-
"label",
|
|
18
|
-
"itemProps",
|
|
19
|
-
"children",
|
|
20
|
-
"helper",
|
|
21
|
-
"hide",
|
|
22
|
-
"render",
|
|
23
|
-
];
|
|
12
|
+
var _excluded = ["hover", "labelWidth", "required", "colon", "label", "itemProps", "children", "helper", "hide", "render"];
|
|
24
13
|
var Content = function Content(_ref) {
|
|
25
14
|
var children = _ref.children,
|
|
26
15
|
helper = _ref.helper,
|
|
27
16
|
value = _ref.value,
|
|
28
17
|
onChange = _ref.onChange;
|
|
29
18
|
var className = useClassName("hw-form-base-item");
|
|
30
|
-
var relChild =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/*#__PURE__*/ React.createElement(
|
|
46
|
-
"div",
|
|
47
|
-
{
|
|
48
|
-
className: className,
|
|
49
|
-
},
|
|
50
|
-
relChild
|
|
51
|
-
),
|
|
52
|
-
/*#__PURE__*/ React.createElement(Index$2, {
|
|
53
|
-
helper: helper,
|
|
54
|
-
})
|
|
55
|
-
);
|
|
19
|
+
var relChild = children && /*#__PURE__*/React.cloneElement(children, {
|
|
20
|
+
value: value,
|
|
21
|
+
onChange: onChange
|
|
22
|
+
});
|
|
23
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
24
|
+
direction: "vertical",
|
|
25
|
+
size: 4,
|
|
26
|
+
style: {
|
|
27
|
+
width: "100%"
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: className
|
|
31
|
+
}, relChild), /*#__PURE__*/React.createElement(Index$2, {
|
|
32
|
+
helper: helper
|
|
33
|
+
}));
|
|
56
34
|
};
|
|
57
35
|
var Index = function Index(_ref2) {
|
|
58
36
|
var hover = _ref2.hover,
|
|
@@ -61,9 +39,9 @@ var Index = function Index(_ref2) {
|
|
|
61
39
|
_ref2$colon = _ref2.colon,
|
|
62
40
|
colon = _ref2$colon === void 0 ? true : _ref2$colon,
|
|
63
41
|
label = _ref2.label;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
42
|
+
_ref2.itemProps;
|
|
43
|
+
_ref2.children;
|
|
44
|
+
var helper = _ref2.helper,
|
|
67
45
|
hide = _ref2.hide,
|
|
68
46
|
render = _ref2.render,
|
|
69
47
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
@@ -71,40 +49,24 @@ var Index = function Index(_ref2) {
|
|
|
71
49
|
form = _useFormContext.form;
|
|
72
50
|
var hideItem = useHide({
|
|
73
51
|
hide: hide,
|
|
74
|
-
form: form
|
|
52
|
+
form: form
|
|
75
53
|
});
|
|
76
54
|
if (hideItem) {
|
|
77
55
|
return null;
|
|
78
56
|
}
|
|
79
|
-
return /*#__PURE__*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
),
|
|
93
|
-
},
|
|
94
|
-
props,
|
|
95
|
-
{
|
|
96
|
-
colon: false,
|
|
97
|
-
required: false,
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
/*#__PURE__*/ React.createElement(
|
|
101
|
-
Content,
|
|
102
|
-
{
|
|
103
|
-
helper: helper,
|
|
104
|
-
},
|
|
105
|
-
render(form)
|
|
106
|
-
)
|
|
107
|
-
);
|
|
57
|
+
return /*#__PURE__*/React.createElement(Form.Item, _extends({
|
|
58
|
+
label: /*#__PURE__*/React.createElement(Index$1, {
|
|
59
|
+
hover: hover,
|
|
60
|
+
labelWidth: labelWidth,
|
|
61
|
+
required: required,
|
|
62
|
+
colon: colon
|
|
63
|
+
}, label)
|
|
64
|
+
}, props, {
|
|
65
|
+
colon: false,
|
|
66
|
+
required: false
|
|
67
|
+
}), /*#__PURE__*/React.createElement(Content, {
|
|
68
|
+
helper: helper
|
|
69
|
+
}, render(form)));
|
|
108
70
|
};
|
|
109
71
|
|
|
110
72
|
export { Index as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React from
|
|
3
|
-
import { Typography } from
|
|
4
|
-
import { useFormContext } from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Typography } from 'antd';
|
|
4
|
+
import { useFormContext } from '../Context/index.js';
|
|
5
5
|
|
|
6
6
|
var Index = function Index(_ref) {
|
|
7
7
|
var helper = _ref.helper;
|
|
@@ -11,21 +11,13 @@ var Index = function Index(_ref) {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
if (typeof helper === "function") {
|
|
14
|
-
return /*#__PURE__*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type: "secondary",
|
|
18
|
-
},
|
|
19
|
-
helper(form)
|
|
20
|
-
);
|
|
14
|
+
return /*#__PURE__*/React.createElement(Typography.Text, {
|
|
15
|
+
type: "secondary"
|
|
16
|
+
}, helper(form));
|
|
21
17
|
}
|
|
22
|
-
return /*#__PURE__*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type: "secondary",
|
|
26
|
-
},
|
|
27
|
-
helper
|
|
28
|
-
);
|
|
18
|
+
return /*#__PURE__*/React.createElement(Typography.Text, {
|
|
19
|
+
type: "secondary"
|
|
20
|
+
}, helper);
|
|
29
21
|
};
|
|
30
22
|
|
|
31
23
|
export { Index as default };
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React from
|
|
3
|
-
import _extends from
|
|
4
|
-
import Index from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
4
|
+
import Index from './BasicItem.js';
|
|
5
5
|
|
|
6
|
-
var RegularFormItem = function (props) {
|
|
6
|
+
var RegularFormItem = (function (props) {
|
|
7
7
|
var type = props.type,
|
|
8
8
|
colon = props.colon;
|
|
9
|
-
return /*#__PURE__*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
-
);
|
|
15
|
-
};
|
|
9
|
+
return /*#__PURE__*/React.createElement(Index, _extends({}, props, {
|
|
10
|
+
colon: type === "submit" ? false : colon
|
|
11
|
+
}));
|
|
12
|
+
});
|
|
16
13
|
|
|
17
14
|
export { RegularFormItem as default };
|
|
18
15
|
// powered by hdj
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { FormItemWithRender } from "../modal";
|
|
3
|
-
declare const _default: ({
|
|
4
|
-
shouldUpdate,
|
|
5
|
-
dependencies,
|
|
6
|
-
hide,
|
|
7
|
-
...props
|
|
8
|
-
}: FormItemWithRender) => JSX.Element;
|
|
3
|
+
declare const _default: ({ shouldUpdate, dependencies, hide, ...props }: FormItemWithRender) => JSX.Element;
|
|
9
4
|
export default _default;
|
|
@@ -1,41 +1,31 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React from
|
|
3
|
-
import _extends from
|
|
4
|
-
import _objectWithoutProperties from
|
|
5
|
-
import { Form } from
|
|
6
|
-
import Index from
|
|
7
|
-
import { useShouldUpdate } 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 { Form } from 'antd';
|
|
6
|
+
import Index from './BasicItem.js';
|
|
7
|
+
import { useShouldUpdate } from './hooks.js';
|
|
8
8
|
|
|
9
9
|
var _excluded = ["shouldUpdate", "dependencies", "hide"];
|
|
10
10
|
var Item = Form.Item;
|
|
11
|
-
var UpFormItem = function (_ref) {
|
|
11
|
+
var UpFormItem = (function (_ref) {
|
|
12
12
|
var shouldUpdate = _ref.shouldUpdate,
|
|
13
13
|
dependencies = _ref.dependencies,
|
|
14
14
|
hide = _ref.hide,
|
|
15
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
16
|
var resultShouldUpdate = useShouldUpdate({
|
|
17
17
|
shouldUpdate: shouldUpdate,
|
|
18
|
-
hide: hide
|
|
18
|
+
hide: hide
|
|
19
19
|
});
|
|
20
|
-
return /*#__PURE__*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_extends(
|
|
30
|
-
{
|
|
31
|
-
hide: hide,
|
|
32
|
-
},
|
|
33
|
-
props
|
|
34
|
-
)
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
};
|
|
20
|
+
return /*#__PURE__*/React.createElement(Item, {
|
|
21
|
+
shouldUpdate: resultShouldUpdate,
|
|
22
|
+
dependencies: dependencies
|
|
23
|
+
}, function () {
|
|
24
|
+
return /*#__PURE__*/React.createElement(Index, _extends({
|
|
25
|
+
hide: hide
|
|
26
|
+
}, props));
|
|
27
|
+
});
|
|
28
|
+
});
|
|
39
29
|
|
|
40
30
|
export { UpFormItem as default };
|
|
41
31
|
// powered by hdj
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
FormItemWithRender,
|
|
4
|
-
HFormInstance,
|
|
5
|
-
} from "@/components/Form/modal";
|
|
2
|
+
import type { FormItemWithRender, HFormInstance } from "@/components/Form/modal";
|
|
6
3
|
import type { HItemProps } from "@/components/Form/modal";
|
|
7
|
-
export declare const useFormItemDomControl: ({
|
|
8
|
-
shouldUpdate,
|
|
9
|
-
hide,
|
|
10
|
-
dependencies,
|
|
11
|
-
}: FormItemWithRender) => ({
|
|
12
|
-
shouldUpdate,
|
|
13
|
-
dependencies,
|
|
14
|
-
hide,
|
|
15
|
-
...props
|
|
16
|
-
}: FormItemWithRender) => JSX.Element;
|
|
4
|
+
export declare const useFormItemDomControl: ({ shouldUpdate, hide, dependencies, }: FormItemWithRender) => ({ shouldUpdate, dependencies, hide, ...props }: FormItemWithRender) => JSX.Element;
|
|
17
5
|
interface UseHideUpItemModal extends Omit<HItemProps, "name"> {
|
|
18
|
-
|
|
6
|
+
form: HFormInstance;
|
|
19
7
|
}
|
|
20
|
-
export declare const useShouldUpdate: ({
|
|
21
|
-
hide,
|
|
22
|
-
shouldUpdate,
|
|
23
|
-
}: Omit<HItemProps, "name">) =>
|
|
24
|
-
| import("rc-field-form/lib/Field").ShouldUpdate<any>
|
|
25
|
-
| undefined;
|
|
8
|
+
export declare const useShouldUpdate: ({ hide, shouldUpdate, }: Omit<HItemProps, "name">) => import("rc-field-form/lib/Field").ShouldUpdate<any> | undefined;
|
|
26
9
|
export declare const useHide: ({ hide, form }: UseHideUpItemModal) => boolean;
|
|
27
10
|
export {};
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import UpFormItem from
|
|
3
|
-
import RegularFormItem from
|
|
4
|
-
import { useMemo } from
|
|
2
|
+
import UpFormItem from './UpFormItem.js';
|
|
3
|
+
import RegularFormItem from './RegularFormItem.js';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
5
|
|
|
6
6
|
var useFormItemDomControl = function useFormItemDomControl(_ref) {
|
|
7
7
|
var shouldUpdate = _ref.shouldUpdate,
|
|
8
8
|
hide = _ref.hide,
|
|
9
9
|
dependencies = _ref.dependencies;
|
|
10
|
-
return useMemo(
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
[shouldUpdate, hide]
|
|
18
|
-
);
|
|
10
|
+
return useMemo(function () {
|
|
11
|
+
if (shouldUpdate || typeof hide === "function" || dependencies) {
|
|
12
|
+
return UpFormItem;
|
|
13
|
+
}
|
|
14
|
+
return RegularFormItem;
|
|
15
|
+
}, [shouldUpdate, hide]);
|
|
19
16
|
};
|
|
20
17
|
var useShouldUpdate = function useShouldUpdate(_ref2) {
|
|
21
18
|
var hide = _ref2.hide,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import { useFormItemDomControl } from
|
|
3
|
-
import React from
|
|
2
|
+
import { useFormItemDomControl } from './hooks.js';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
|
|
5
|
-
var Item = function (props) {
|
|
5
|
+
var Item = (function (props) {
|
|
6
6
|
var Component = useFormItemDomControl(props);
|
|
7
|
-
return /*#__PURE__*/
|
|
8
|
-
};
|
|
7
|
+
return /*#__PURE__*/React.createElement(Component, props);
|
|
8
|
+
});
|
|
9
9
|
|
|
10
10
|
export { Item as default };
|
|
11
11
|
// powered by hdj
|
|
@@ -2,13 +2,5 @@ import type { HFormItemProps } from "@/components/Form/modal";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ConnectConfigModal } from "@/components/Form/modal";
|
|
4
4
|
import type { ConnectResultProps } from "@/components/Form/modal";
|
|
5
|
-
declare const _default: (
|
|
6
|
-
Component: React.FunctionComponent | React.ComponentClass,
|
|
7
|
-
config?: ConnectConfigModal
|
|
8
|
-
) => (
|
|
9
|
-
props: HFormItemProps
|
|
10
|
-
) => React.ReactElement<
|
|
11
|
-
ConnectResultProps,
|
|
12
|
-
string | React.JSXElementConstructor<any>
|
|
13
|
-
>;
|
|
5
|
+
declare const _default: (Component: React.FunctionComponent | React.ComponentClass, config?: ConnectConfigModal) => (props: HFormItemProps) => React.ReactElement<ConnectResultProps, string | React.JSXElementConstructor<any>>;
|
|
14
6
|
export default _default;
|
package/es/Form/HFormConnect.js
CHANGED
|
@@ -1,57 +1,18 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _Object$keys from
|
|
3
|
-
import _Object$getOwnPropertySymbols from
|
|
4
|
-
import _filterInstanceProperty from
|
|
5
|
-
import _Object$getOwnPropertyDescriptor from
|
|
6
|
-
import _forEachInstanceProperty from
|
|
7
|
-
import _Object$getOwnPropertyDescriptors from
|
|
8
|
-
import _Object$defineProperties from
|
|
9
|
-
import _Object$defineProperty from
|
|
10
|
-
import _defineProperty from
|
|
11
|
-
import { useFormContext } from
|
|
12
|
-
import React, { useEffect } from
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
7
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
8
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
9
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
+
import { useFormContext } from './Context/index.js';
|
|
12
|
+
import React, { useEffect } from 'react';
|
|
13
13
|
|
|
14
|
-
function ownKeys(object, enumerableOnly) {
|
|
15
|
-
|
|
16
|
-
if (_Object$getOwnPropertySymbols) {
|
|
17
|
-
var symbols = _Object$getOwnPropertySymbols(object);
|
|
18
|
-
enumerableOnly &&
|
|
19
|
-
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
20
|
-
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
21
|
-
})),
|
|
22
|
-
keys.push.apply(keys, symbols);
|
|
23
|
-
}
|
|
24
|
-
return keys;
|
|
25
|
-
}
|
|
26
|
-
function _objectSpread(target) {
|
|
27
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
28
|
-
var _context, _context2;
|
|
29
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
30
|
-
i % 2
|
|
31
|
-
? _forEachInstanceProperty((_context = ownKeys(Object(source), !0))).call(
|
|
32
|
-
_context,
|
|
33
|
-
function (key) {
|
|
34
|
-
_defineProperty(target, key, source[key]);
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
: _Object$getOwnPropertyDescriptors
|
|
38
|
-
? _Object$defineProperties(
|
|
39
|
-
target,
|
|
40
|
-
_Object$getOwnPropertyDescriptors(source)
|
|
41
|
-
)
|
|
42
|
-
: _forEachInstanceProperty((_context2 = ownKeys(Object(source)))).call(
|
|
43
|
-
_context2,
|
|
44
|
-
function (key) {
|
|
45
|
-
_Object$defineProperty(
|
|
46
|
-
target,
|
|
47
|
-
key,
|
|
48
|
-
_Object$getOwnPropertyDescriptor(source, key)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
return target;
|
|
54
|
-
}
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
55
16
|
var formatMaker = function formatMaker(itemProps, formats) {
|
|
56
17
|
if (!formats) {
|
|
57
18
|
return formats;
|
|
@@ -64,12 +25,11 @@ var formatMaker = function formatMaker(itemProps, formats) {
|
|
|
64
25
|
},
|
|
65
26
|
outputValue: function outputValue(value) {
|
|
66
27
|
return _outputValue(itemProps, value);
|
|
67
|
-
}
|
|
28
|
+
}
|
|
68
29
|
};
|
|
69
30
|
};
|
|
70
|
-
var HFormConnect = function (Component) {
|
|
71
|
-
var config =
|
|
72
|
-
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
31
|
+
var HFormConnect = (function (Component) {
|
|
32
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
73
33
|
var _config$format = config.format,
|
|
74
34
|
format = _config$format === void 0 ? {} : _config$format;
|
|
75
35
|
return function (props) {
|
|
@@ -78,45 +38,25 @@ var HFormConnect = function (Component) {
|
|
|
78
38
|
var _useFormContext = useFormContext(),
|
|
79
39
|
form = _useFormContext.form,
|
|
80
40
|
_useFormContext$value = _useFormContext.valueType,
|
|
81
|
-
valueType =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
form === null || form === void 0
|
|
86
|
-
? void 0
|
|
87
|
-
: form.addFormat(name, formatMaker(props, format[valueType]));
|
|
88
|
-
},
|
|
89
|
-
[valueType, props]
|
|
90
|
-
);
|
|
41
|
+
valueType = _useFormContext$value === void 0 ? "float" : _useFormContext$value;
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
form === null || form === void 0 ? void 0 : form.addFormat(name, formatMaker(props, format[valueType]));
|
|
44
|
+
}, [valueType, props]);
|
|
91
45
|
var addFormat = function addFormat(aFormat) {
|
|
92
|
-
form === null || form === void 0
|
|
93
|
-
? void 0
|
|
94
|
-
: form.addFormat(name, formatMaker(props, aFormat[valueType]));
|
|
46
|
+
form === null || form === void 0 ? void 0 : form.addFormat(name, formatMaker(props, aFormat[valueType]));
|
|
95
47
|
};
|
|
96
48
|
var addDispatchListener = function addDispatchListener(key, fn) {
|
|
97
|
-
form === null || form === void 0
|
|
98
|
-
|
|
99
|
-
:
|
|
100
|
-
|
|
101
|
-
key: key,
|
|
102
|
-
name: name,
|
|
103
|
-
},
|
|
104
|
-
fn
|
|
105
|
-
);
|
|
49
|
+
form === null || form === void 0 ? void 0 : form.addDispatchListener({
|
|
50
|
+
key: key,
|
|
51
|
+
name: name
|
|
52
|
+
}, fn);
|
|
106
53
|
};
|
|
107
|
-
return /*#__PURE__*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
{},
|
|
112
|
-
{
|
|
113
|
-
addFormat: addFormat,
|
|
114
|
-
addDispatchListener: addDispatchListener,
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
);
|
|
54
|
+
return /*#__PURE__*/React.createElement(Component, _objectSpread(_objectSpread({}, props), {}, {
|
|
55
|
+
addFormat: addFormat,
|
|
56
|
+
addDispatchListener: addDispatchListener
|
|
57
|
+
}));
|
|
118
58
|
};
|
|
119
|
-
};
|
|
59
|
+
});
|
|
120
60
|
|
|
121
61
|
export { HFormConnect as default };
|
|
122
62
|
// powered by hdj
|
package/es/Form/InitSet.d.ts
CHANGED
package/es/Form/InitSet.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React, { useEffect } from
|
|
3
|
-
import { useFormContext } from
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { useFormContext } from './Context/index.js';
|
|
4
4
|
|
|
5
|
-
var InitSet = function (
|
|
6
|
-
var initValues = _ref.initValues;
|
|
5
|
+
var InitSet = (function () {
|
|
7
6
|
var _useFormContext = useFormContext(),
|
|
8
7
|
form = _useFormContext.form;
|
|
9
8
|
useEffect(function () {
|
|
10
|
-
form.initValues(
|
|
9
|
+
form.initValues();
|
|
11
10
|
}, []);
|
|
12
|
-
return /*#__PURE__*/
|
|
13
|
-
};
|
|
11
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
12
|
+
});
|
|
14
13
|
|
|
15
14
|
export { InitSet as default };
|
|
16
15
|
// powered by hdj
|
package/es/Form/Label.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { HoverModal } from "./modal";
|
|
2
2
|
import React from "react";
|
|
3
3
|
interface IProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
labelWidth?: number;
|
|
5
|
+
hover?: string | HoverModal;
|
|
6
|
+
colon?: boolean;
|
|
7
|
+
required?: boolean;
|
|
8
8
|
}
|
|
9
9
|
declare const Index: React.FC<IProps>;
|
|
10
10
|
export default Index;
|