@hw-component/form 1.10.35 → 1.10.37
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/Form/hooks/useHForm.js +3 -1
- package/es/Form/hooks/useReqControl.js +4 -5
- package/es/Form/index.js +0 -1
- package/es/Select/hooks/norHooks.js +1 -0
- package/lib/Form/hooks/useHForm.js +3 -1
- package/lib/Form/hooks/useReqControl.js +4 -5
- package/lib/Form/index.js +0 -1
- package/lib/Select/hooks/norHooks.js +1 -0
- package/package.json +1 -1
- package/src/components/Form/hooks/useHForm.ts +3 -1
- package/src/components/Form/hooks/useReqControl.ts +0 -1
- package/src/components/Form/index.tsx +0 -1
- package/src/components/Select/hooks/norHooks.ts +1 -0
- package/src/components/TDPicker/RangePicker.tsx +2 -1
- package/src/pages/Form/index.tsx +54 -43
|
@@ -49,7 +49,9 @@ var useHForm = (function () {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
var resultValue = format(value);
|
|
52
|
-
|
|
52
|
+
if (formatKey !== "inputValue") {
|
|
53
|
+
Reflect.deleteProperty(newValue, key);
|
|
54
|
+
}
|
|
53
55
|
newValue = _objectSpread(_objectSpread({}, newValue), resultValue);
|
|
54
56
|
});
|
|
55
57
|
return newValue;
|
|
@@ -20,17 +20,16 @@ var useSubRequest = function useSubRequest(_ref) {
|
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
22
|
subVal = form === null || form === void 0 ? void 0 : form.outputValues(value, preserve);
|
|
23
|
-
console.log(subVal, "sss");
|
|
24
23
|
params = getSaveParams();
|
|
25
24
|
if (!request) {
|
|
26
|
-
_context.next =
|
|
25
|
+
_context.next = 5;
|
|
27
26
|
break;
|
|
28
27
|
}
|
|
29
|
-
_context.next =
|
|
28
|
+
_context.next = 5;
|
|
30
29
|
return request(subVal, params);
|
|
31
|
-
case
|
|
30
|
+
case 5:
|
|
32
31
|
onFinish === null || onFinish === void 0 || onFinish(subVal, params);
|
|
33
|
-
case
|
|
32
|
+
case 6:
|
|
34
33
|
case "end":
|
|
35
34
|
return _context.stop();
|
|
36
35
|
}
|
package/es/Form/index.js
CHANGED
|
@@ -72,6 +72,7 @@ var useOptionsRequest = function useOptionsRequest(_ref) {
|
|
|
72
72
|
}
|
|
73
73
|
return params;
|
|
74
74
|
};
|
|
75
|
+
console.log(dispatchManual, "dispatchManual");
|
|
75
76
|
var _useRequest = useRequest(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
76
77
|
var requestParams,
|
|
77
78
|
type,
|
|
@@ -52,7 +52,9 @@ var useHForm = (function () {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
var resultValue = format(value);
|
|
55
|
-
|
|
55
|
+
if (formatKey !== "inputValue") {
|
|
56
|
+
Reflect.deleteProperty(newValue, key);
|
|
57
|
+
}
|
|
56
58
|
newValue = _objectSpread(_objectSpread({}, newValue), resultValue);
|
|
57
59
|
});
|
|
58
60
|
return newValue;
|
|
@@ -21,17 +21,16 @@ var useSubRequest = function useSubRequest(_ref) {
|
|
|
21
21
|
while (1) switch (_context.prev = _context.next) {
|
|
22
22
|
case 0:
|
|
23
23
|
subVal = form === null || form === void 0 ? void 0 : form.outputValues(value, preserve);
|
|
24
|
-
console.log(subVal, "sss");
|
|
25
24
|
params = getSaveParams();
|
|
26
25
|
if (!request) {
|
|
27
|
-
_context.next =
|
|
26
|
+
_context.next = 5;
|
|
28
27
|
break;
|
|
29
28
|
}
|
|
30
|
-
_context.next =
|
|
29
|
+
_context.next = 5;
|
|
31
30
|
return request(subVal, params);
|
|
32
|
-
case
|
|
31
|
+
case 5:
|
|
33
32
|
onFinish === null || onFinish === void 0 || onFinish(subVal, params);
|
|
34
|
-
case
|
|
33
|
+
case 6:
|
|
35
34
|
case "end":
|
|
36
35
|
return _context.stop();
|
|
37
36
|
}
|
package/lib/Form/index.js
CHANGED
|
@@ -73,6 +73,7 @@ var useOptionsRequest = function useOptionsRequest(_ref) {
|
|
|
73
73
|
}
|
|
74
74
|
return params;
|
|
75
75
|
};
|
|
76
|
+
console.log(dispatchManual, "dispatchManual");
|
|
76
77
|
var _useRequest = ahooks.useRequest(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
77
78
|
var requestParams,
|
|
78
79
|
type,
|
package/package.json
CHANGED
|
@@ -55,6 +55,7 @@ const HRangePicker: React.FC<HRangePickerProps> = ({
|
|
|
55
55
|
inputValue: (item, initValue) => {
|
|
56
56
|
const { name: valueName = "" } = item;
|
|
57
57
|
const resultObj = {};
|
|
58
|
+
|
|
58
59
|
Object.values(dateMapKeys).forEach((key) => {
|
|
59
60
|
if (initValue[key]) {
|
|
60
61
|
resultObj[key] = initValue[key];
|
|
@@ -62,7 +63,7 @@ const HRangePicker: React.FC<HRangePickerProps> = ({
|
|
|
62
63
|
});
|
|
63
64
|
const hasKeys = Object.keys(resultObj).length !== 0;
|
|
64
65
|
return {
|
|
65
|
-
[valueName as string]: hasKeys ? resultObj :
|
|
66
|
+
[valueName as string]: hasKeys ? resultObj :null,
|
|
66
67
|
};
|
|
67
68
|
},
|
|
68
69
|
outputValue: (item, outputValue) => {
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
HForm,
|
|
3
|
+
HFormConfigProvider,
|
|
4
|
+
useHForm,
|
|
5
|
+
HSelect,
|
|
6
|
+
HBasicForm, HRangePicker,
|
|
7
7
|
} from "../../components";
|
|
8
8
|
import {useEffect, useState} from "react";
|
|
9
9
|
import { Button, Form, Input, Space } from "antd";
|
|
@@ -33,39 +33,52 @@ const Test3 = ({ value = {}, onChange }) => {
|
|
|
33
33
|
</Space>
|
|
34
34
|
);
|
|
35
35
|
};
|
|
36
|
-
const TestItem = () => {
|
|
37
|
-
return (
|
|
38
|
-
<Form.Item name="name1">
|
|
39
|
-
<Test3 />
|
|
40
|
-
</Form.Item>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
36
|
const Test = (props) => {
|
|
44
|
-
useEffect(()=>{
|
|
45
|
-
console.log("ffff")
|
|
46
|
-
},[]);
|
|
47
37
|
return <div>ffff</div>;
|
|
48
38
|
};
|
|
49
39
|
const Basic = () => {
|
|
50
40
|
return (
|
|
51
41
|
<HBasicForm
|
|
52
42
|
configData={[
|
|
53
|
-
{
|
|
54
|
-
label: "你好",
|
|
55
|
-
type: "inputNumberGroup",
|
|
56
|
-
name: "jgTime",
|
|
57
|
-
},
|
|
58
43
|
{
|
|
59
44
|
label:"test",
|
|
60
45
|
name:"test",
|
|
61
46
|
render:()=>{
|
|
62
47
|
return <Test/>
|
|
63
48
|
}
|
|
64
|
-
}
|
|
49
|
+
},{
|
|
50
|
+
name:'deviceType',
|
|
51
|
+
label:"deviceType"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label:"select",
|
|
55
|
+
name:"select",
|
|
56
|
+
type:"select",
|
|
57
|
+
dispatch: {
|
|
58
|
+
fnKey: 'reload',
|
|
59
|
+
dependencies: ['deviceType'],
|
|
60
|
+
},
|
|
61
|
+
itemProps:{
|
|
62
|
+
request:()=>{
|
|
63
|
+
console.log("request")
|
|
64
|
+
return Promise.resolve([])
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
65
68
|
]}
|
|
66
69
|
/>
|
|
67
70
|
);
|
|
68
71
|
};
|
|
72
|
+
|
|
73
|
+
const TestItem = ({value,...props}) => {
|
|
74
|
+
return (
|
|
75
|
+
<div>
|
|
76
|
+
1
|
|
77
|
+
<HRangePicker value={value} {...props}/>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
69
82
|
export default () => {
|
|
70
83
|
const form = useHForm();
|
|
71
84
|
const [id, setId] = useState(1);
|
|
@@ -99,41 +112,39 @@ export default () => {
|
|
|
99
112
|
<div style={{ width: 1000 }}>
|
|
100
113
|
<HForm
|
|
101
114
|
configData={[
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
},
|
|
115
|
+
// {
|
|
116
|
+
// noStyle: true,
|
|
117
|
+
// nameKey: "sendSetting",
|
|
118
|
+
// render: () => {
|
|
119
|
+
// return <Basic />;
|
|
120
|
+
// },
|
|
121
|
+
// },
|
|
109
122
|
{
|
|
110
|
-
|
|
111
|
-
|
|
123
|
+
name:'time',
|
|
124
|
+
label:"time",
|
|
125
|
+
type:'rangePicker',
|
|
112
126
|
itemProps:{
|
|
113
|
-
|
|
127
|
+
valueMap:{
|
|
128
|
+
start:"timeStart",
|
|
129
|
+
end:"timeEnd"
|
|
130
|
+
}
|
|
114
131
|
}
|
|
115
|
-
}
|
|
132
|
+
}
|
|
116
133
|
]}
|
|
117
134
|
dismissOnPressEnter={false}
|
|
118
135
|
labelWidth={88}
|
|
119
136
|
form={form}
|
|
120
137
|
initialValues={{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
endTime: "14:00:00",
|
|
138
|
+
timeStart:"1748491247",
|
|
139
|
+
timeEnd:"1748577647"
|
|
124
140
|
}}
|
|
125
141
|
labelAlign={"left"}
|
|
126
142
|
onValuesChange={(val) => {
|
|
127
143
|
console.log(val, "onValuesChange");
|
|
128
144
|
}}
|
|
129
145
|
requiredMode
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return new Promise<any>((resolve) => {
|
|
133
|
-
setTimeout(() => {
|
|
134
|
-
resolve(params);
|
|
135
|
-
}, 3000);
|
|
136
|
-
});
|
|
146
|
+
onFinish={(val)=>{
|
|
147
|
+
console.log(val);
|
|
137
148
|
}}
|
|
138
149
|
/>
|
|
139
150
|
</div>
|
|
@@ -164,7 +175,7 @@ export default () => {
|
|
|
164
175
|
</div>
|
|
165
176
|
<div
|
|
166
177
|
onClick={() => {
|
|
167
|
-
form.
|
|
178
|
+
form.resetFieldsInitValue();
|
|
168
179
|
}}
|
|
169
180
|
>
|
|
170
181
|
重置
|