@hw-component/form 0.0.7-beta-v8 → 0.0.8-beta-v1
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.
|
@@ -138,7 +138,7 @@ var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
|
138
138
|
options: options,
|
|
139
139
|
value: value,
|
|
140
140
|
noMatchItemRender: noMatchItemRender
|
|
141
|
-
}, oldVale);
|
|
141
|
+
}, oldVale) || [];
|
|
142
142
|
}
|
|
143
143
|
return tag({
|
|
144
144
|
options: options,
|
|
@@ -180,7 +180,7 @@ var useValueChange = function useValueChange(params) {
|
|
|
180
180
|
setVal(value);
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
|
-
if (options
|
|
183
|
+
if (options) {
|
|
184
184
|
setVal(function (oldVale) {
|
|
185
185
|
return matchNotFind(params, oldVale);
|
|
186
186
|
});
|
|
@@ -139,7 +139,7 @@ var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
|
139
139
|
options: options,
|
|
140
140
|
value: value,
|
|
141
141
|
noMatchItemRender: noMatchItemRender
|
|
142
|
-
}, oldVale);
|
|
142
|
+
}, oldVale) || [];
|
|
143
143
|
}
|
|
144
144
|
return tag({
|
|
145
145
|
options: options,
|
|
@@ -181,7 +181,7 @@ var useValueChange = function useValueChange(params) {
|
|
|
181
181
|
setVal(value);
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
if (options
|
|
184
|
+
if (options) {
|
|
185
185
|
setVal(function (oldVale) {
|
|
186
186
|
return matchNotFind(params, oldVale);
|
|
187
187
|
});
|
package/package.json
CHANGED
|
@@ -104,7 +104,7 @@ const matchNotFind = (
|
|
|
104
104
|
return single({ options, value, noMatchItemRender });
|
|
105
105
|
}
|
|
106
106
|
if (mode === "multiple") {
|
|
107
|
-
return multiple({ options, value, noMatchItemRender }, oldVale);
|
|
107
|
+
return multiple({ options, value, noMatchItemRender }, oldVale)||[];
|
|
108
108
|
}
|
|
109
109
|
return tag({ options, value }, oldVale);
|
|
110
110
|
}; //不匹配
|
|
@@ -142,8 +142,7 @@ export const useValueChange = (params: PartialHSelectProps) => {
|
|
|
142
142
|
setVal(value);
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
if (options && value) {
|
|
145
|
+
if (options) {
|
|
147
146
|
setVal((oldVale) => {
|
|
148
147
|
return matchNotFind(params, oldVale);
|
|
149
148
|
});
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -2,6 +2,16 @@ import { HForm, HFormConfigProvider, useHForm } from "../../components";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
|
|
4
4
|
const formData = (options) => {
|
|
5
|
+
const op = [
|
|
6
|
+
{
|
|
7
|
+
key: 1,
|
|
8
|
+
value: "是",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: 0,
|
|
12
|
+
value: "否",
|
|
13
|
+
},
|
|
14
|
+
];
|
|
5
15
|
return [
|
|
6
16
|
{
|
|
7
17
|
label: "输入框",
|
|
@@ -21,7 +31,7 @@ const formData = (options) => {
|
|
|
21
31
|
rules: [{ required: true }],
|
|
22
32
|
},
|
|
23
33
|
{
|
|
24
|
-
label: "下拉框",
|
|
34
|
+
label: "下拉框213",
|
|
25
35
|
name: "select",
|
|
26
36
|
type: "select",
|
|
27
37
|
dispatch: {
|
|
@@ -29,11 +39,7 @@ const formData = (options) => {
|
|
|
29
39
|
dependencies: ["selectInput", "sz"],
|
|
30
40
|
},
|
|
31
41
|
itemProps: {
|
|
32
|
-
|
|
33
|
-
console.log(values, "paramsparamsparams");
|
|
34
|
-
const { label = "123", value = 1 } = params;
|
|
35
|
-
return Promise.resolve([{ label, value }]);
|
|
36
|
-
},
|
|
42
|
+
options: op,
|
|
37
43
|
showSearch: true,
|
|
38
44
|
},
|
|
39
45
|
rules: [{ required: true }],
|
|
@@ -161,6 +167,10 @@ export default () => {
|
|
|
161
167
|
defaultComponent={{
|
|
162
168
|
test: Test,
|
|
163
169
|
}}
|
|
170
|
+
fieldNames={{
|
|
171
|
+
label: "value",
|
|
172
|
+
value: "key",
|
|
173
|
+
}}
|
|
164
174
|
>
|
|
165
175
|
<HForm
|
|
166
176
|
configData={formData(options)}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { HSelect } from "../../components";
|
|
2
2
|
import { Space } from "antd";
|
|
3
|
+
import {useState} from "react";
|
|
3
4
|
export default () => {
|
|
5
|
+
const [selectVal,setSelectVal]=useState([10]);
|
|
4
6
|
return (
|
|
5
7
|
<Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
|
|
6
8
|
<HSelect
|
|
@@ -15,10 +17,12 @@ export default () => {
|
|
|
15
17
|
{ name: "测试2", value: 20, userId: 112321 },
|
|
16
18
|
]}
|
|
17
19
|
placeholder="多选"
|
|
20
|
+
value={selectVal}
|
|
18
21
|
onChange={(val, option) => {
|
|
19
|
-
|
|
22
|
+
setSelectVal(val);
|
|
20
23
|
}}
|
|
21
24
|
allSelect={true}
|
|
25
|
+
mode={"multiple"}
|
|
22
26
|
showSearch={true}
|
|
23
27
|
/>
|
|
24
28
|
<HSelect
|