@strictly/react-form 0.0.33 → 0.0.34
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/.turbo/turbo-build.log
CHANGED
|
@@ -7,12 +7,12 @@ $ tsup
|
|
|
7
7
|
[34mCLI[39m Target: es6
|
|
8
8
|
[34mCJS[39m Build start
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m64.19 KB[39m
|
|
11
|
-
[32mCJS[39m ⚡️ Build success in 102ms
|
|
12
10
|
[32mESM[39m [1mdist/index.js [22m[32m60.01 KB[39m
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m ⚡️ Build success in 127ms
|
|
12
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m64.19 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 158ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m38.
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m38.
|
|
18
|
-
Done in 8.
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 6824ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m38.69 KB[39m
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m38.69 KB[39m
|
|
18
|
+
Done in 8.27s.
|
package/core/mobx/hooks.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type ReadonlyTypeOfType,
|
|
3
|
+
type Type,
|
|
3
4
|
type ValueOfType,
|
|
4
5
|
} from '@strictly/define'
|
|
5
6
|
import {
|
|
@@ -13,13 +14,25 @@ import {
|
|
|
13
14
|
import { peek } from './peek'
|
|
14
15
|
|
|
15
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
-
type
|
|
17
|
+
type FormModelInterface<T extends Type = any> = Pick<
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
FormModel<T, any, any, any, any>,
|
|
20
|
+
| 'fields'
|
|
21
|
+
| 'value'
|
|
22
|
+
| 'getValidation'
|
|
23
|
+
| 'validateField'
|
|
24
|
+
| 'setFieldValue'
|
|
25
|
+
| 'validateSubmit'
|
|
26
|
+
| 'isFieldDirty'
|
|
27
|
+
| 'isValuePathActive'
|
|
28
|
+
>
|
|
29
|
+
|
|
30
|
+
type ValueOfModel<M extends FormModelInterface> = M extends FormModelInterface<infer T>
|
|
17
31
|
? ValueOfType<ReadonlyTypeOfType<T>>
|
|
18
32
|
: never
|
|
19
33
|
|
|
20
34
|
export function useDefaultMobxFormHooks<
|
|
21
|
-
|
|
22
|
-
M extends FormModel<any, any, any, any, any>,
|
|
35
|
+
M extends FormModelInterface,
|
|
23
36
|
F extends M['fields'] = M['fields'],
|
|
24
37
|
>(
|
|
25
38
|
model: M,
|
package/dist/index.d.cts
CHANGED
|
@@ -181,8 +181,9 @@ declare abstract class FormModel<T extends Type, ValueToTypePaths extends Readon
|
|
|
181
181
|
validateSubmit(): boolean;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
type
|
|
185
|
-
|
|
184
|
+
type FormModelInterface<T extends Type = any> = Pick<FormModel<T, any, any, any, any>, 'fields' | 'value' | 'getValidation' | 'validateField' | 'setFieldValue' | 'validateSubmit' | 'isFieldDirty' | 'isValuePathActive'>;
|
|
185
|
+
type ValueOfModel<M extends FormModelInterface> = M extends FormModelInterface<infer T> ? ValueOfType<ReadonlyTypeOfType<T>> : never;
|
|
186
|
+
declare function useDefaultMobxFormHooks<M extends FormModelInterface, F extends M['fields'] = M['fields']>(model: M, { onValidFieldSubmit, onValidFormSubmit, }?: {
|
|
186
187
|
onValidFieldSubmit?: <Path extends keyof F>(valuePath: Path) => void;
|
|
187
188
|
onValidFormSubmit?: (value: ValueOfModel<M>) => void;
|
|
188
189
|
}): {
|
package/dist/index.d.ts
CHANGED
|
@@ -181,8 +181,9 @@ declare abstract class FormModel<T extends Type, ValueToTypePaths extends Readon
|
|
|
181
181
|
validateSubmit(): boolean;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
type
|
|
185
|
-
|
|
184
|
+
type FormModelInterface<T extends Type = any> = Pick<FormModel<T, any, any, any, any>, 'fields' | 'value' | 'getValidation' | 'validateField' | 'setFieldValue' | 'validateSubmit' | 'isFieldDirty' | 'isValuePathActive'>;
|
|
185
|
+
type ValueOfModel<M extends FormModelInterface> = M extends FormModelInterface<infer T> ? ValueOfType<ReadonlyTypeOfType<T>> : never;
|
|
186
|
+
declare function useDefaultMobxFormHooks<M extends FormModelInterface, F extends M['fields'] = M['fields']>(model: M, { onValidFieldSubmit, onValidFormSubmit, }?: {
|
|
186
187
|
onValidFieldSubmit?: <Path extends keyof F>(valuePath: Path) => void;
|
|
187
188
|
onValidFormSubmit?: (value: ValueOfModel<M>) => void;
|
|
188
189
|
}): {
|