@hw-component/form 0.0.7-beta-v9 → 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.
|
@@ -11,7 +11,6 @@ import 'core-js/modules/es.array.find-index.js';
|
|
|
11
11
|
import 'core-js/modules/es.object.to-string.js';
|
|
12
12
|
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
13
13
|
import 'core-js/modules/es.array.map.js';
|
|
14
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
|
15
14
|
import { useState, useEffect } from 'react';
|
|
16
15
|
import { itemOpProvider } from '../utils.js';
|
|
17
16
|
|
|
@@ -139,7 +138,7 @@ var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
|
139
138
|
options: options,
|
|
140
139
|
value: value,
|
|
141
140
|
noMatchItemRender: noMatchItemRender
|
|
142
|
-
}, oldVale);
|
|
141
|
+
}, oldVale) || [];
|
|
143
142
|
}
|
|
144
143
|
return tag({
|
|
145
144
|
options: options,
|
|
@@ -181,7 +180,7 @@ var useValueChange = function useValueChange(params) {
|
|
|
181
180
|
setVal(value);
|
|
182
181
|
return;
|
|
183
182
|
}
|
|
184
|
-
if (options
|
|
183
|
+
if (options) {
|
|
185
184
|
setVal(function (oldVale) {
|
|
186
185
|
return matchNotFind(params, oldVale);
|
|
187
186
|
});
|
|
@@ -12,7 +12,6 @@ require('core-js/modules/es.array.find-index.js');
|
|
|
12
12
|
require('core-js/modules/es.object.to-string.js');
|
|
13
13
|
require('core-js/modules/web.dom-collections.for-each.js');
|
|
14
14
|
require('core-js/modules/es.array.map.js');
|
|
15
|
-
require('core-js/modules/es.regexp.to-string.js');
|
|
16
15
|
var React = require('react');
|
|
17
16
|
var utils = require('../utils.js');
|
|
18
17
|
|
|
@@ -140,7 +139,7 @@ var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
|
140
139
|
options: options,
|
|
141
140
|
value: value,
|
|
142
141
|
noMatchItemRender: noMatchItemRender
|
|
143
|
-
}, oldVale);
|
|
142
|
+
}, oldVale) || [];
|
|
144
143
|
}
|
|
145
144
|
return tag({
|
|
146
145
|
options: options,
|
|
@@ -182,7 +181,7 @@ var useValueChange = function useValueChange(params) {
|
|
|
182
181
|
setVal(value);
|
|
183
182
|
return;
|
|
184
183
|
}
|
|
185
|
-
if (options
|
|
184
|
+
if (options) {
|
|
186
185
|
setVal(function (oldVale) {
|
|
187
186
|
return matchNotFind(params, oldVale);
|
|
188
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?.toString()) {
|
|
145
|
+
if (options) {
|
|
147
146
|
setVal((oldVale) => {
|
|
148
147
|
return matchNotFind(params, oldVale);
|
|
149
148
|
});
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -5,11 +5,11 @@ const formData = (options) => {
|
|
|
5
5
|
const op = [
|
|
6
6
|
{
|
|
7
7
|
key: 1,
|
|
8
|
-
value:
|
|
8
|
+
value: "是",
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
key: 0,
|
|
12
|
-
value:
|
|
12
|
+
value: "否",
|
|
13
13
|
},
|
|
14
14
|
];
|
|
15
15
|
return [
|
|
@@ -39,7 +39,7 @@ const formData = (options) => {
|
|
|
39
39
|
dependencies: ["selectInput", "sz"],
|
|
40
40
|
},
|
|
41
41
|
itemProps: {
|
|
42
|
-
options:op,
|
|
42
|
+
options: op,
|
|
43
43
|
showSearch: true,
|
|
44
44
|
},
|
|
45
45
|
rules: [{ required: true }],
|
|
@@ -168,8 +168,8 @@ export default () => {
|
|
|
168
168
|
test: Test,
|
|
169
169
|
}}
|
|
170
170
|
fieldNames={{
|
|
171
|
-
label:
|
|
172
|
-
value:
|
|
171
|
+
label: "value",
|
|
172
|
+
value: "key",
|
|
173
173
|
}}
|
|
174
174
|
>
|
|
175
175
|
<HForm
|
|
@@ -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
|