@carefrees/form-utils-react-hooks 0.0.8 → 0.0.10
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/esm/hooks/register/register.FormList.js +2 -2
- package/esm/hooks/useWatch.d.ts +1 -1
- package/lib/hooks/register/register.FormList.js +2 -2
- package/lib/hooks/useWatch.d.ts +1 -1
- package/package.json +2 -2
- package/src/hooks/register/register.FormList.ts +2 -2
- package/src/hooks/useWatch.ts +1 -1
|
@@ -16,10 +16,10 @@ const useRegisterFormList = (options)=>{
|
|
|
16
16
|
formListInstance.formItemInstance = formItemInstance;
|
|
17
17
|
formListInstance.parentDataField = parentName;
|
|
18
18
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
19
|
-
const unMount = form.registerFormList(
|
|
19
|
+
const unMount = form.registerFormList(newName, formListInstance);
|
|
20
20
|
return ()=>unMount();
|
|
21
21
|
}, [
|
|
22
|
-
|
|
22
|
+
newName,
|
|
23
23
|
formListInstance
|
|
24
24
|
]);
|
|
25
25
|
return {
|
package/esm/hooks/useWatch.d.ts
CHANGED
|
@@ -16,4 +16,4 @@ export declare class WatchInstanceBase {
|
|
|
16
16
|
/**
|
|
17
17
|
* 字段监听
|
|
18
18
|
*/
|
|
19
|
-
export declare const useWatch: (name: string, form
|
|
19
|
+
export declare const useWatch: (name: string, form?: FormInstanceBase, callBack?: (value: any, form: FormInstanceBase) => void) => [any, FormInstanceBase, WatchInstanceBase];
|
|
@@ -44,10 +44,10 @@ const useRegisterFormList = (options)=>{
|
|
|
44
44
|
formListInstance.formItemInstance = formItemInstance;
|
|
45
45
|
formListInstance.parentDataField = parentName;
|
|
46
46
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
47
|
-
const unMount = form.registerFormList(
|
|
47
|
+
const unMount = form.registerFormList(newName, formListInstance);
|
|
48
48
|
return ()=>unMount();
|
|
49
49
|
}, [
|
|
50
|
-
|
|
50
|
+
newName,
|
|
51
51
|
formListInstance
|
|
52
52
|
]);
|
|
53
53
|
return {
|
package/lib/hooks/useWatch.d.ts
CHANGED
|
@@ -16,4 +16,4 @@ export declare class WatchInstanceBase {
|
|
|
16
16
|
/**
|
|
17
17
|
* 字段监听
|
|
18
18
|
*/
|
|
19
|
-
export declare const useWatch: (name: string, form
|
|
19
|
+
export declare const useWatch: (name: string, form?: FormInstanceBase, callBack?: (value: any, form: FormInstanceBase) => void) => [any, FormInstanceBase, WatchInstanceBase];
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "SunLxy <1011771396@qq.com>",
|
|
4
4
|
"description": "表单组件公共hooks",
|
|
5
5
|
"homepage": "https://github.com/SunLxy/carefrees-form-utils",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.10",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
9
9
|
"module": "esm/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"esm"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@carefrees/form-utils": "^0.0.
|
|
24
|
+
"@carefrees/form-utils": "^0.0.10"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "18.2.21",
|
|
@@ -19,9 +19,9 @@ export const useRegisterFormList = (options: RegisterFormListOptions) => {
|
|
|
19
19
|
formListInstance.parentDataField = parentName;
|
|
20
20
|
|
|
21
21
|
useEffect(() => {
|
|
22
|
-
const unMount = form.registerFormList(
|
|
22
|
+
const unMount = form.registerFormList(newName, formListInstance);
|
|
23
23
|
return () => unMount();
|
|
24
|
-
}, [
|
|
24
|
+
}, [newName, formListInstance]);
|
|
25
25
|
|
|
26
26
|
return {
|
|
27
27
|
ruleInstance,
|
package/src/hooks/useWatch.ts
CHANGED
|
@@ -35,7 +35,7 @@ export class WatchInstanceBase {
|
|
|
35
35
|
*/
|
|
36
36
|
export const useWatch = (
|
|
37
37
|
name: string,
|
|
38
|
-
form
|
|
38
|
+
form?: FormInstanceBase,
|
|
39
39
|
callBack?: (value: any, form: FormInstanceBase) => void,
|
|
40
40
|
) => {
|
|
41
41
|
const formInstance = form || useFormInstance();
|