@hw-component/form 0.0.4-beta-v8 → 0.0.4-beta-v9
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/index.js +5 -1
- package/es/Select/hooks/changeHooks.js +1 -1
- package/lib/Form/hooks/index.js +5 -1
- package/lib/Select/hooks/changeHooks.js +1 -1
- package/package.json +1 -1
- package/src/components/Form/hooks/index.ts +1 -1
- package/src/components/Form/hooks/useHForm.ts +1 -0
- package/src/components/Select/hooks/changeHooks.tsx +2 -1
- package/src/components/Select/index.tsx +0 -1
- package/src/pages/Form/index.tsx +0 -1
package/es/Form/hooks/index.js
CHANGED
|
@@ -127,6 +127,11 @@ var useValuesChange = function useValuesChange(_ref4) {
|
|
|
127
127
|
var _dispatchItem$name = dispatchItem[name],
|
|
128
128
|
fnKey = _dispatchItem$name.fnKey,
|
|
129
129
|
reset = _dispatchItem$name.reset;
|
|
130
|
+
reset && form.setFields([{
|
|
131
|
+
name: name,
|
|
132
|
+
value: null,
|
|
133
|
+
errors: []
|
|
134
|
+
}]);
|
|
130
135
|
form.dispatch({
|
|
131
136
|
key: fnKey,
|
|
132
137
|
name: name
|
|
@@ -134,7 +139,6 @@ var useValuesChange = function useValuesChange(_ref4) {
|
|
|
134
139
|
changedValues: changedValues,
|
|
135
140
|
oldValues: values
|
|
136
141
|
});
|
|
137
|
-
reset && form.resetFields([name]);
|
|
138
142
|
});
|
|
139
143
|
}
|
|
140
144
|
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(changedValues, values);
|
|
@@ -178,7 +178,7 @@ var useValueChange = function useValueChange(params) {
|
|
|
178
178
|
onChange(newChangeVal, subItemOps);
|
|
179
179
|
};
|
|
180
180
|
useEffect(function () {
|
|
181
|
-
if (mode === "tags") {
|
|
181
|
+
if (mode === "tags" || value === null || value === undefined) {
|
|
182
182
|
setVal(value);
|
|
183
183
|
return;
|
|
184
184
|
}
|
package/lib/Form/hooks/index.js
CHANGED
|
@@ -128,6 +128,11 @@ var useValuesChange = function useValuesChange(_ref4) {
|
|
|
128
128
|
var _dispatchItem$name = dispatchItem[name],
|
|
129
129
|
fnKey = _dispatchItem$name.fnKey,
|
|
130
130
|
reset = _dispatchItem$name.reset;
|
|
131
|
+
reset && form.setFields([{
|
|
132
|
+
name: name,
|
|
133
|
+
value: null,
|
|
134
|
+
errors: []
|
|
135
|
+
}]);
|
|
131
136
|
form.dispatch({
|
|
132
137
|
key: fnKey,
|
|
133
138
|
name: name
|
|
@@ -135,7 +140,6 @@ var useValuesChange = function useValuesChange(_ref4) {
|
|
|
135
140
|
changedValues: changedValues,
|
|
136
141
|
oldValues: values
|
|
137
142
|
});
|
|
138
|
-
reset && form.resetFields([name]);
|
|
139
143
|
});
|
|
140
144
|
}
|
|
141
145
|
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(changedValues, values);
|
|
@@ -179,7 +179,7 @@ var useValueChange = function useValueChange(params) {
|
|
|
179
179
|
onChange(newChangeVal, subItemOps);
|
|
180
180
|
};
|
|
181
181
|
React.useEffect(function () {
|
|
182
|
-
if (mode === "tags") {
|
|
182
|
+
if (mode === "tags" || value === null || value === undefined) {
|
|
183
183
|
setVal(value);
|
|
184
184
|
return;
|
|
185
185
|
}
|
package/package.json
CHANGED
|
@@ -87,6 +87,7 @@ export const useValuesChange = ({
|
|
|
87
87
|
const dispatchKey = Object.keys(dispatchItem);
|
|
88
88
|
dispatchKey.forEach((name) => {
|
|
89
89
|
const {fnKey,reset} = dispatchItem[name];
|
|
90
|
+
reset&&form.setFields([{name,value:null,errors:[]}]);
|
|
90
91
|
form.dispatch(
|
|
91
92
|
{
|
|
92
93
|
key:fnKey,
|
|
@@ -97,7 +98,6 @@ export const useValuesChange = ({
|
|
|
97
98
|
oldValues: values,
|
|
98
99
|
}
|
|
99
100
|
);
|
|
100
|
-
reset&&form.resetFields([name]);
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
onValuesChange?.(changedValues, values);
|
|
@@ -16,6 +16,7 @@ export default () => {
|
|
|
16
16
|
const initDispatch: Record<string, argsFn> = {};
|
|
17
17
|
let cacheValues: Record<string, any> = {};
|
|
18
18
|
let isLoading = false;
|
|
19
|
+
|
|
19
20
|
const norAddItemDispatch = (name, manual, fn) => {
|
|
20
21
|
if (manual === false&&name) {
|
|
21
22
|
initDispatch[name]=fn;
|
|
@@ -138,10 +138,11 @@ export const useValueChange = (params: PartialHSelectProps) => {
|
|
|
138
138
|
onChange(newChangeVal, subItemOps);
|
|
139
139
|
};
|
|
140
140
|
useEffect(() => {
|
|
141
|
-
if (mode === "tags") {
|
|
141
|
+
if (mode === "tags"||value===null||value===undefined) {
|
|
142
142
|
setVal(value);
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
+
|
|
145
146
|
if (options && value) {
|
|
146
147
|
setVal((oldVale) => {
|
|
147
148
|
return matchNotFind(params, oldVale);
|
|
@@ -37,7 +37,6 @@ const Index: React.FC<HSelectProps> = ({
|
|
|
37
37
|
}) => {
|
|
38
38
|
const { icon, render } = modeConfig?.[mode || ""] || {};
|
|
39
39
|
const { fieldNames } = useMatchConfigProps({ fieldNames: propsFieldNames });
|
|
40
|
-
|
|
41
40
|
const selfFilterOption = useFilterOption({ filterOption, serviceSearch });
|
|
42
41
|
const {
|
|
43
42
|
run,
|