react-form-manage 1.0.8-beta.12 → 1.0.8-beta.14
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/dist/providers/Form.js
CHANGED
|
@@ -267,7 +267,7 @@ function useForm(formNameOrFormInstance) {
|
|
|
267
267
|
const formContext = useContext(FormContext);
|
|
268
268
|
const targetFormName = isNil(formNameOrFormInstance) ? formContext == null ? void 0 : formContext.formName : typeof formNameOrFormInstance === "object" && formNameOrFormInstance !== null ? formNameOrFormInstance.formName : formNameOrFormInstance;
|
|
269
269
|
const formInstance = useFormStore((state) => {
|
|
270
|
-
return
|
|
270
|
+
return state.formInstances.find((i) => i.formName === targetFormName);
|
|
271
271
|
});
|
|
272
272
|
return [formInstance];
|
|
273
273
|
}
|
|
@@ -38,7 +38,7 @@ interface FormStoreState {
|
|
|
38
38
|
initialValues: Record<string, any>;
|
|
39
39
|
formStates: Record<string, any>;
|
|
40
40
|
cacheData: Record<string, any>;
|
|
41
|
-
formInstances:
|
|
41
|
+
formInstances: FormInstance[];
|
|
42
42
|
submitHistory: Record<string, any[]>;
|
|
43
43
|
listeners: ListenerItem[];
|
|
44
44
|
cleanUpStack: CleanUpItem[];
|
package/dist/stores/formStore.js
CHANGED
package/package.json
CHANGED
package/src/providers/Form.tsx
CHANGED
|
@@ -422,9 +422,7 @@ export function useForm<T = any>(
|
|
|
422
422
|
: (formNameOrFormInstance as string | undefined);
|
|
423
423
|
|
|
424
424
|
const formInstance = useFormStore((state) => {
|
|
425
|
-
return
|
|
426
|
-
(i) => i.formName === targetFormName,
|
|
427
|
-
);
|
|
425
|
+
return state.formInstances.find((i) => i.formName === targetFormName);
|
|
428
426
|
}) as PublicFormInstance<T> | undefined;
|
|
429
427
|
|
|
430
428
|
return [formInstance];
|
package/src/stores/formStore.ts
CHANGED
|
@@ -44,7 +44,7 @@ interface FormStoreState {
|
|
|
44
44
|
initialValues: Record<string, any>;
|
|
45
45
|
formStates: Record<string, any>;
|
|
46
46
|
cacheData: Record<string, any>;
|
|
47
|
-
formInstances:
|
|
47
|
+
formInstances: FormInstance[];
|
|
48
48
|
submitHistory: Record<string, any[]>;
|
|
49
49
|
listeners: ListenerItem[];
|
|
50
50
|
cleanUpStack: CleanUpItem[];
|
|
@@ -59,7 +59,7 @@ const createFormStoreSlice = (storeSet: any, storeGet: any, api: any) => ({
|
|
|
59
59
|
initialValues: {},
|
|
60
60
|
formStates: {},
|
|
61
61
|
cacheData: {},
|
|
62
|
-
formInstances:
|
|
62
|
+
formInstances: [],
|
|
63
63
|
submitHistory: {},
|
|
64
64
|
setData(formName, name, value) {
|
|
65
65
|
return storeSet(
|