@volverjs/form-vue 1.0.0-beta.12 → 1.0.0-beta.13
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/README.md +247 -239
- package/dist/VvForm.d.ts +5 -5
- package/dist/VvFormField.d.ts +7 -7
- package/dist/VvFormTemplate.d.ts +4 -4
- package/dist/VvFormWrapper.d.ts +3 -3
- package/dist/index.d.ts +17 -17
- package/dist/index.es.js +475 -453
- package/dist/index.umd.js +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.ts +2 -2
- package/package.json +52 -56
- package/src/VvForm.ts +287 -291
- package/src/VvFormField.ts +323 -325
- package/src/VvFormTemplate.ts +193 -188
- package/src/VvFormWrapper.ts +144 -147
- package/src/enums.ts +26 -26
- package/src/index.ts +117 -128
- package/src/types.ts +111 -117
- package/src/utils.ts +93 -97
package/src/VvFormWrapper.ts
CHANGED
|
@@ -1,171 +1,168 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
type InjectionKey,
|
|
3
|
+
type Ref,
|
|
4
|
+
computed,
|
|
5
|
+
defineComponent,
|
|
6
|
+
inject,
|
|
7
|
+
provide,
|
|
8
|
+
readonly,
|
|
9
|
+
ref,
|
|
10
|
+
toRefs,
|
|
11
|
+
watch,
|
|
12
|
+
h,
|
|
13
|
+
type DeepReadonly,
|
|
14
14
|
} from 'vue'
|
|
15
15
|
import type { TypeOf, z } from 'zod'
|
|
16
16
|
import type {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
FormSchema,
|
|
18
|
+
InjectedFormData,
|
|
19
|
+
InjectedFormWrapperData,
|
|
20
20
|
} from './types'
|
|
21
21
|
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const wrapperProvided = inject(wrapperProvideKey, undefined)
|
|
43
|
-
const fields = ref(new Set<string>())
|
|
44
|
-
const fieldsErrors: Ref<
|
|
22
|
+
export function defineFormWrapper<Schema extends FormSchema>(formProvideKey: InjectionKey<InjectedFormData<Schema>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>) {
|
|
23
|
+
const VvFormWrapper = defineComponent({
|
|
24
|
+
name: 'VvFormWrapper',
|
|
25
|
+
props: {
|
|
26
|
+
name: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
tag: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: undefined,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
emits: ['invalid', 'valid'],
|
|
36
|
+
expose: ['fields', 'invalid'],
|
|
37
|
+
setup(props, { emit }) {
|
|
38
|
+
const injectedFormData = inject(formProvideKey)
|
|
39
|
+
const wrapperProvided = inject(wrapperProvideKey, undefined)
|
|
40
|
+
const fields = ref(new Set<string>())
|
|
41
|
+
const fieldsErrors: Ref<
|
|
45
42
|
Map<string, z.inferFormattedError<Schema>>
|
|
46
43
|
> = ref(new Map())
|
|
47
|
-
|
|
44
|
+
const { name } = toRefs(props)
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
// provide data to child fields
|
|
47
|
+
provide(wrapperProvideKey, {
|
|
48
|
+
name: readonly(name),
|
|
49
|
+
errors: fieldsErrors,
|
|
50
|
+
fields,
|
|
51
|
+
})
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
// add fields to parent wrapper
|
|
54
|
+
watch(
|
|
55
|
+
fields,
|
|
56
|
+
(newValue) => {
|
|
57
|
+
if (wrapperProvided?.fields) {
|
|
58
|
+
newValue.forEach((field) => {
|
|
59
|
+
wrapperProvided?.fields.value.add(field)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{ deep: true },
|
|
64
|
+
)
|
|
68
65
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
66
|
+
// add fields to parent wrapper
|
|
67
|
+
watch(
|
|
68
|
+
() => new Map(fieldsErrors.value),
|
|
69
|
+
(newValue, oldValue) => {
|
|
70
|
+
if (wrapperProvided?.errors) {
|
|
71
|
+
Array.from(oldValue.keys()).forEach((key) => {
|
|
72
|
+
wrapperProvided.errors.value.delete(key)
|
|
73
|
+
})
|
|
74
|
+
Array.from(newValue.keys()).forEach((key) => {
|
|
75
|
+
const value = newValue.get(key)
|
|
76
|
+
if (value) {
|
|
77
|
+
wrapperProvided.errors.value.set(key, value)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{ deep: true },
|
|
83
|
+
)
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
const invalid = computed(() => {
|
|
86
|
+
if (!injectedFormData?.invalid.value) {
|
|
87
|
+
return false
|
|
88
|
+
}
|
|
89
|
+
return fieldsErrors.value.size > 0
|
|
90
|
+
})
|
|
94
91
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
watch(invalid, () => {
|
|
93
|
+
if (invalid.value) {
|
|
94
|
+
emit('invalid')
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
emit('valid')
|
|
98
|
+
}
|
|
99
|
+
})
|
|
102
100
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
101
|
+
return {
|
|
102
|
+
formData: injectedFormData?.formData,
|
|
103
|
+
errors: injectedFormData?.errors,
|
|
104
|
+
submit: injectedFormData?.submit,
|
|
105
|
+
validate: injectedFormData?.validate,
|
|
106
|
+
invalid,
|
|
107
|
+
fields,
|
|
108
|
+
fieldsErrors,
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
render() {
|
|
112
|
+
if (this.tag) {
|
|
113
|
+
return h(this.tag, null, {
|
|
114
|
+
default: () =>
|
|
115
|
+
this.$slots.default?.({
|
|
116
|
+
invalid: this.invalid,
|
|
117
|
+
formData: this.formData,
|
|
118
|
+
submit: this.submit,
|
|
119
|
+
validate: this.validate,
|
|
120
|
+
errors: this.errors,
|
|
121
|
+
fieldsErrors: this.fieldsErrors,
|
|
122
|
+
}) ?? this.$slots.defalut,
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
return (
|
|
126
|
+
this.$slots.default?.({
|
|
127
|
+
invalid: this.invalid,
|
|
128
|
+
formData: this.formData,
|
|
129
|
+
submit: this.submit,
|
|
130
|
+
validate: this.validate,
|
|
131
|
+
errors: this.errors,
|
|
132
|
+
fieldsErrors: this.fieldsErrors,
|
|
133
|
+
}) ?? this.$slots.defalut
|
|
134
|
+
)
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
/**
|
|
138
|
+
* An hack to add types to the default slot
|
|
139
|
+
*/
|
|
140
|
+
return VvFormWrapper as typeof VvFormWrapper & {
|
|
141
|
+
new (): {
|
|
142
|
+
$slots: {
|
|
143
|
+
default: (_: {
|
|
144
|
+
invalid: boolean
|
|
145
|
+
formData: unknown extends
|
|
146
|
+
| Partial<TypeOf<Schema>>
|
|
147
|
+
| undefined
|
|
148
|
+
? undefined
|
|
149
|
+
: Partial<TypeOf<Schema>> | undefined
|
|
150
|
+
submit: () => Promise<boolean>
|
|
151
|
+
validate: () => Promise<boolean>
|
|
152
|
+
errors: Readonly<
|
|
155
153
|
Ref<DeepReadonly<z.inferFormattedError<Schema>>>
|
|
156
154
|
>
|
|
157
|
-
|
|
155
|
+
fieldsErrors: Map<
|
|
158
156
|
string,
|
|
159
157
|
Record<
|
|
160
158
|
string,
|
|
161
159
|
{
|
|
162
|
-
|
|
160
|
+
_errors: string[]
|
|
163
161
|
}
|
|
164
162
|
>
|
|
165
163
|
>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
164
|
+
}) => any
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
171
168
|
}
|
package/src/enums.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
export enum FormFieldType {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
text = 'text',
|
|
3
|
+
number = 'number',
|
|
4
|
+
email = 'email',
|
|
5
|
+
password = 'password',
|
|
6
|
+
tel = 'tel',
|
|
7
|
+
url = 'url',
|
|
8
|
+
search = 'search',
|
|
9
|
+
date = 'date',
|
|
10
|
+
time = 'time',
|
|
11
|
+
datetimeLocal = 'datetime-local',
|
|
12
|
+
month = 'month',
|
|
13
|
+
week = 'week',
|
|
14
|
+
color = 'color',
|
|
15
|
+
select = 'select',
|
|
16
|
+
checkbox = 'checkbox',
|
|
17
|
+
radio = 'radio',
|
|
18
|
+
textarea = 'textarea',
|
|
19
|
+
radioGroup = 'radioGroup',
|
|
20
|
+
checkboxGroup = 'checkboxGroup',
|
|
21
|
+
combobox = 'combobox',
|
|
22
|
+
custom = 'custom',
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export enum FormStatus {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
invalid = 'invalid',
|
|
27
|
+
valid = 'valid',
|
|
28
|
+
submitting = 'submitting',
|
|
29
|
+
updated = 'updated',
|
|
30
|
+
unknown = 'unknown',
|
|
31
31
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,134 +1,126 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
getCurrentInstance,
|
|
3
|
+
type App,
|
|
4
|
+
inject,
|
|
5
|
+
type InjectionKey,
|
|
6
|
+
type Plugin,
|
|
7
7
|
} from 'vue'
|
|
8
|
+
import type { AnyZodObject } from 'zod'
|
|
8
9
|
import { defineFormField } from './VvFormField'
|
|
9
10
|
import { defineForm } from './VvForm'
|
|
10
11
|
import { defineFormWrapper } from './VvFormWrapper'
|
|
11
12
|
import { defineFormTemplate } from './VvFormTemplate'
|
|
12
13
|
import type {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
InjectedFormData,
|
|
15
|
+
InjectedFormWrapperData,
|
|
16
|
+
InjectedFormFieldData,
|
|
17
|
+
FormComposableOptions,
|
|
18
|
+
FormPluginOptions,
|
|
19
|
+
FormTemplateItem,
|
|
20
|
+
Path,
|
|
21
|
+
PathValue,
|
|
22
|
+
FormSchema,
|
|
23
|
+
FormTemplate,
|
|
23
24
|
} from './types'
|
|
24
|
-
import type { AnyZodObject } from 'zod'
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
// create injection keys
|
|
31
|
-
const formInjectionKey = Symbol() as InjectionKey<InjectedFormData<Schema>>
|
|
32
|
-
const formWrapperInjectionKey = Symbol() as InjectionKey<
|
|
26
|
+
function _formFactory<Schema extends FormSchema>(schema: Schema, options: FormComposableOptions<Schema> = {}) {
|
|
27
|
+
// create injection keys
|
|
28
|
+
const formInjectionKey = Symbol('formInjectionKey') as InjectionKey<InjectedFormData<Schema>>
|
|
29
|
+
const formWrapperInjectionKey = Symbol('formWrapperInjectionKey') as InjectionKey<
|
|
33
30
|
InjectedFormWrapperData<Schema>
|
|
34
31
|
>
|
|
35
|
-
|
|
32
|
+
const formFieldInjectionKey = Symbol('formFieldInjectionKey') as InjectionKey<
|
|
36
33
|
InjectedFormFieldData<Schema>
|
|
37
34
|
>
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
36
|
+
// create components
|
|
37
|
+
const VvFormWrapper = defineFormWrapper(
|
|
38
|
+
formInjectionKey,
|
|
39
|
+
formWrapperInjectionKey,
|
|
40
|
+
)
|
|
41
|
+
const VvFormField = defineFormField(
|
|
42
|
+
formInjectionKey,
|
|
43
|
+
formWrapperInjectionKey,
|
|
44
|
+
formFieldInjectionKey,
|
|
45
|
+
options,
|
|
46
|
+
)
|
|
47
|
+
const VvFormTemplate = defineFormTemplate(formInjectionKey, VvFormField)
|
|
48
|
+
const {
|
|
49
|
+
VvForm,
|
|
50
|
+
errors,
|
|
51
|
+
status,
|
|
52
|
+
invalid,
|
|
53
|
+
readonly,
|
|
54
|
+
formData,
|
|
55
|
+
validate,
|
|
56
|
+
submit,
|
|
57
|
+
ignoreUpdates,
|
|
58
|
+
stopUpdatesWatch,
|
|
59
|
+
} = defineForm(schema, formInjectionKey, options, VvFormTemplate)
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
return {
|
|
62
|
+
VvForm,
|
|
63
|
+
VvFormWrapper,
|
|
64
|
+
VvFormField,
|
|
65
|
+
VvFormTemplate,
|
|
66
|
+
formInjectionKey,
|
|
67
|
+
formWrapperInjectionKey,
|
|
68
|
+
formFieldInjectionKey,
|
|
69
|
+
errors,
|
|
70
|
+
status,
|
|
71
|
+
invalid,
|
|
72
|
+
readonly,
|
|
73
|
+
formData,
|
|
74
|
+
validate,
|
|
75
|
+
submit,
|
|
76
|
+
ignoreUpdates,
|
|
77
|
+
stopUpdatesWatch,
|
|
78
|
+
}
|
|
82
79
|
}
|
|
83
80
|
|
|
84
|
-
export const pluginInjectionKey = Symbol() as InjectionKey<FormPluginOptions>
|
|
81
|
+
export const pluginInjectionKey = Symbol('pluginInjectionKey') as InjectionKey<FormPluginOptions>
|
|
85
82
|
|
|
86
|
-
export
|
|
87
|
-
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
install(app: App, { global = false } = {}) {
|
|
96
|
-
app.provide(pluginInjectionKey, options)
|
|
83
|
+
export function createForm(options: FormPluginOptions): Plugin & Partial<ReturnType<typeof useForm>> {
|
|
84
|
+
let toReturn: Partial<ReturnType<typeof useForm>> = {}
|
|
85
|
+
if (options.schema) {
|
|
86
|
+
toReturn = _formFactory(options.schema as AnyZodObject, options)
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
...toReturn,
|
|
90
|
+
install(app: App, { global = false } = {}) {
|
|
91
|
+
app.provide(pluginInjectionKey, options)
|
|
97
92
|
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
if (global) {
|
|
94
|
+
app.config.globalProperties.$vvForm = options
|
|
100
95
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
96
|
+
if (toReturn?.VvForm) {
|
|
97
|
+
app.component('VvForm', toReturn.VvForm)
|
|
98
|
+
}
|
|
99
|
+
if (toReturn?.VvFormWrapper) {
|
|
100
|
+
app.component('VvFormWrapper', toReturn.VvFormWrapper)
|
|
101
|
+
}
|
|
102
|
+
if (toReturn?.VvFormField) {
|
|
103
|
+
app.component('VvFormField', toReturn.VvFormField)
|
|
104
|
+
}
|
|
105
|
+
if (toReturn?.VvFormTemplate) {
|
|
106
|
+
app.component('VvFormTemplate', toReturn.VvFormTemplate)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
}
|
|
116
111
|
}
|
|
117
112
|
|
|
118
|
-
export
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
...options,
|
|
130
|
-
} as FormComposableOptions<AnyZodObject>,
|
|
131
|
-
)
|
|
113
|
+
export function useForm<Schema extends FormSchema>(schema: Schema, options: FormComposableOptions<Schema> = {}) {
|
|
114
|
+
if (!getCurrentInstance()) {
|
|
115
|
+
return _formFactory(schema, options)
|
|
116
|
+
}
|
|
117
|
+
return _formFactory(
|
|
118
|
+
schema as AnyZodObject,
|
|
119
|
+
{
|
|
120
|
+
...inject(pluginInjectionKey, {}),
|
|
121
|
+
...options,
|
|
122
|
+
} as FormComposableOptions<AnyZodObject>,
|
|
123
|
+
)
|
|
132
124
|
}
|
|
133
125
|
|
|
134
126
|
export { FormFieldType } from './enums'
|
|
@@ -140,28 +132,25 @@ type FormFieldComponent = ReturnType<typeof defineFormField>
|
|
|
140
132
|
type FormTemplateComponent = ReturnType<typeof defineFormTemplate>
|
|
141
133
|
|
|
142
134
|
export type {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
135
|
+
InjectedFormData,
|
|
136
|
+
InjectedFormWrapperData,
|
|
137
|
+
InjectedFormFieldData,
|
|
138
|
+
FormComposableOptions,
|
|
139
|
+
FormSchema,
|
|
140
|
+
FormPluginOptions,
|
|
141
|
+
FormComponent,
|
|
142
|
+
FormWrapperComponent,
|
|
143
|
+
FormFieldComponent,
|
|
144
|
+
FormTemplate,
|
|
145
|
+
FormTemplateComponent,
|
|
146
|
+
FormTemplateItem,
|
|
147
|
+
Path,
|
|
148
|
+
PathValue,
|
|
157
149
|
}
|
|
158
150
|
|
|
159
151
|
/**
|
|
160
152
|
* @deprecated Use `useForm()` instead
|
|
161
153
|
*/
|
|
162
|
-
export
|
|
163
|
-
|
|
164
|
-
options: FormComposableOptions<Schema> = {},
|
|
165
|
-
) => {
|
|
166
|
-
return _formFactory(schema, options)
|
|
154
|
+
export function formFactory<Schema extends FormSchema>(schema: Schema, options: FormComposableOptions<Schema> = {}) {
|
|
155
|
+
return _formFactory(schema, options)
|
|
167
156
|
}
|