@hw-component/form 1.2.0 → 1.2.1
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.
|
@@ -14,7 +14,6 @@ var useDis = function useDis(buttonProps) {
|
|
|
14
14
|
setCountdown = _useState4[1];
|
|
15
15
|
var setBtnDisabled = function setBtnDisabled(_ref) {
|
|
16
16
|
var changedValues = _ref.changedValues;
|
|
17
|
-
console.log(changedValues, "changeValue");
|
|
18
17
|
if (!!countdown) {
|
|
19
18
|
return setBtnDis(true);
|
|
20
19
|
}
|
|
@@ -28,8 +27,11 @@ var useDis = function useDis(buttonProps) {
|
|
|
28
27
|
setBtnDis(!!countdown);
|
|
29
28
|
}, [countdown]);
|
|
30
29
|
useEffect(function () {
|
|
31
|
-
if (
|
|
32
|
-
|
|
30
|
+
if (!!countdown) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (typeof disabled === "boolean") {
|
|
34
|
+
setBtnDis(disabled);
|
|
33
35
|
}
|
|
34
36
|
}, [disabled]);
|
|
35
37
|
return {
|
|
@@ -15,7 +15,6 @@ var useDis = function useDis(buttonProps) {
|
|
|
15
15
|
setCountdown = _useState4[1];
|
|
16
16
|
var setBtnDisabled = function setBtnDisabled(_ref) {
|
|
17
17
|
var changedValues = _ref.changedValues;
|
|
18
|
-
console.log(changedValues, "changeValue");
|
|
19
18
|
if (!!countdown) {
|
|
20
19
|
return setBtnDis(true);
|
|
21
20
|
}
|
|
@@ -29,8 +28,11 @@ var useDis = function useDis(buttonProps) {
|
|
|
29
28
|
setBtnDis(!!countdown);
|
|
30
29
|
}, [countdown]);
|
|
31
30
|
React.useEffect(function () {
|
|
32
|
-
if (
|
|
33
|
-
|
|
31
|
+
if (!!countdown) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (typeof disabled === "boolean") {
|
|
35
|
+
setBtnDis(disabled);
|
|
34
36
|
}
|
|
35
37
|
}, [disabled]);
|
|
36
38
|
return {
|
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ export const useDis=(buttonProps:ButtonProps)=>{
|
|
|
6
6
|
const [btnDis,setBtnDis]=useState<boolean|undefined>(!!disabled);
|
|
7
7
|
const [countdown, setCountdown] = useState<number>(0);
|
|
8
8
|
const setBtnDisabled=({changedValues})=>{
|
|
9
|
-
console.log(changedValues,"changeValue")
|
|
10
9
|
if (!!countdown){
|
|
11
10
|
return setBtnDis(true);
|
|
12
11
|
}
|
|
@@ -20,9 +19,13 @@ export const useDis=(buttonProps:ButtonProps)=>{
|
|
|
20
19
|
setBtnDis(!!countdown);
|
|
21
20
|
}, [countdown]);
|
|
22
21
|
useEffect(() => {
|
|
23
|
-
if (
|
|
24
|
-
|
|
22
|
+
if (!!countdown){
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (typeof disabled==="boolean"){
|
|
26
|
+
setBtnDis(disabled);
|
|
25
27
|
}
|
|
28
|
+
|
|
26
29
|
}, [disabled]);
|
|
27
30
|
return {
|
|
28
31
|
disabled:btnDis,
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HForm, HFormConfigProvider, useHForm } from "../../components";
|
|
2
2
|
import { Button, Form, Input } from "antd";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import {useRequest} from "ahooks";
|
|
4
5
|
|
|
5
6
|
const formData = () => {
|
|
6
7
|
return [
|
|
@@ -102,25 +103,6 @@ const formData = () => {
|
|
|
102
103
|
manual:false
|
|
103
104
|
},
|
|
104
105
|
},
|
|
105
|
-
{
|
|
106
|
-
type: "submit",
|
|
107
|
-
itemProps: {
|
|
108
|
-
extraList: [
|
|
109
|
-
<Button
|
|
110
|
-
key="wh"
|
|
111
|
-
onClick={() => {
|
|
112
|
-
console.log("起飞");
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
115
|
-
芜湖
|
|
116
|
-
</Button>,
|
|
117
|
-
<Ttta key="aa" />,
|
|
118
|
-
"666",
|
|
119
|
-
"submit",
|
|
120
|
-
"reset",
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
106
|
];
|
|
125
107
|
};
|
|
126
108
|
function Ttta({ form }) {
|
|
@@ -142,6 +124,13 @@ const Test = (props) => {
|
|
|
142
124
|
export default () => {
|
|
143
125
|
const form = useHForm();
|
|
144
126
|
const [aForm] = Form.useForm();
|
|
127
|
+
const {run,loading}=useRequest(async ()=>{
|
|
128
|
+
await new Promise((resolve)=>{
|
|
129
|
+
setTimeout(()=>{
|
|
130
|
+
resolve({})
|
|
131
|
+
},2000)
|
|
132
|
+
})
|
|
133
|
+
},{manual:true});
|
|
145
134
|
return (
|
|
146
135
|
<div style={{ overflow: "auto", height: "90vh" ,padding:30}}>
|
|
147
136
|
<Form form={aForm} initialValues={{ ttim: "132123" }}>
|
|
@@ -169,17 +158,12 @@ export default () => {
|
|
|
169
158
|
configData={formData()}
|
|
170
159
|
labelWidth={200}
|
|
171
160
|
form={form}
|
|
172
|
-
onFinish={
|
|
173
|
-
console.log(value);
|
|
174
|
-
}}
|
|
175
|
-
initialValues={{
|
|
176
|
-
nameTest:"fffff"
|
|
177
|
-
}}
|
|
161
|
+
onFinish={run}
|
|
178
162
|
/>
|
|
179
163
|
</HFormConfigProvider>
|
|
180
164
|
<div
|
|
181
165
|
onClick={() => {
|
|
182
|
-
|
|
166
|
+
form.submit();
|
|
183
167
|
}}
|
|
184
168
|
>
|
|
185
169
|
点我
|