@effect-app/vue-components 0.15.23 → 0.15.25
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/types/components/OmegaForm/InputProps.d.ts +3 -3
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaErrors.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaErrorsContext.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaInputVuetify.vue.d.ts +3 -3
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
- package/dist/types/components/OmegaForm/index.d.ts +7 -7
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +3 -3
- package/dist/vue-components.es.js +6 -6
- package/dist/vue-components.es10.js +1 -3
- package/dist/vue-components.es11.js +5 -5
- package/dist/vue-components.es12.js +5 -5
- package/dist/vue-components.es13.js +2 -111
- package/dist/vue-components.es14.js +4 -0
- package/dist/vue-components.es15.js +88 -7
- package/dist/vue-components.es17.js +7 -2
- package/dist/vue-components.es18.js +2 -89
- package/dist/vue-components.es2.js +12 -12
- package/dist/vue-components.es20.js +111 -2
- package/dist/vue-components.es22.js +1 -1
- package/dist/vue-components.es23.js +2 -90
- package/dist/vue-components.es24.js +90 -11
- package/dist/vue-components.es25.js +11 -2
- package/dist/vue-components.es26.js +1 -1
- package/dist/vue-components.es4.js +39 -38
- package/dist/vue-components.es5.js +66 -28
- package/dist/vue-components.es6.js +28 -66
- package/dist/vue-components.es7.js +39 -40
- package/dist/vue-components.es9.js +7 -9
- package/package.json +20 -17
- package/src/components/OmegaForm/InputProps.ts +23 -35
- package/src/components/OmegaForm/OmegaArray.vue +24 -14
- package/src/components/OmegaForm/OmegaAutoGen.vue +38 -30
- package/src/components/OmegaForm/OmegaErrors.vue +25 -14
- package/src/components/OmegaForm/OmegaErrorsContext.ts +5 -13
- package/src/components/OmegaForm/OmegaFormInput.vue +17 -10
- package/src/components/OmegaForm/OmegaFormStuff.ts +141 -136
- package/src/components/OmegaForm/OmegaInput.vue +13 -10
- package/src/components/OmegaForm/OmegaInputVuetify.vue +18 -15
- package/src/components/OmegaForm/OmegaInternalInput.vue +34 -34
- package/src/components/OmegaForm/OmegaWrapper.vue +60 -58
- package/src/components/OmegaForm/getOmegaStore.ts +6 -7
- package/src/components/OmegaForm/index.ts +7 -7
- package/src/components/OmegaForm/useOmegaForm.ts +74 -76
- package/src/utils/index.ts +2 -2
- package/dist/vue-components.es16.js +0 -4
- /package/dist/{vue-components.es21.js → vue-components.es19.js} +0 -0
|
@@ -61,15 +61,13 @@
|
|
|
61
61
|
:error="inputProps.error"
|
|
62
62
|
v-bind="$attrs"
|
|
63
63
|
:model-value="vuetifyValue"
|
|
64
|
-
@update:model-value="
|
|
65
|
-
(e
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
inputProps.field.handleChange(undefined as any)
|
|
70
|
-
}
|
|
64
|
+
@update:model-value="(e: any) => {
|
|
65
|
+
if (e || e === 0) {
|
|
66
|
+
inputProps.field.handleChange(Number(e) as any)
|
|
67
|
+
} else {
|
|
68
|
+
inputProps.field.handleChange(undefined as any)
|
|
71
69
|
}
|
|
72
|
-
"
|
|
70
|
+
}"
|
|
73
71
|
/>
|
|
74
72
|
<v-select
|
|
75
73
|
v-if="inputProps.type === 'select' || inputProps.type === 'multiple'"
|
|
@@ -90,10 +88,8 @@
|
|
|
90
88
|
/>
|
|
91
89
|
|
|
92
90
|
<v-autocomplete
|
|
93
|
-
v-if="
|
|
94
|
-
|
|
95
|
-
inputProps.type === 'autocompletemultiple'
|
|
96
|
-
"
|
|
91
|
+
v-if="inputProps.type === 'autocomplete'
|
|
92
|
+
|| inputProps.type === 'autocompletemultiple'"
|
|
97
93
|
:id="inputProps.id"
|
|
98
94
|
:clearable="inputProps.type === 'autocomplete'"
|
|
99
95
|
:multiple="inputProps.type === 'autocompletemultiple'"
|
|
@@ -112,8 +108,15 @@
|
|
|
112
108
|
</div>
|
|
113
109
|
</template>
|
|
114
110
|
|
|
115
|
-
<script
|
|
116
|
-
|
|
111
|
+
<script
|
|
112
|
+
setup
|
|
113
|
+
lang="ts"
|
|
114
|
+
generic="
|
|
115
|
+
From extends Record<PropertyKey, any>,
|
|
116
|
+
Name extends DeepKeys<From>
|
|
117
|
+
"
|
|
118
|
+
>
|
|
119
|
+
import { type DeepKeys } from "@tanstack/vue-form"
|
|
117
120
|
import type { InputProps } from "./InputProps"
|
|
118
121
|
|
|
119
122
|
defineProps<{
|
|
@@ -127,7 +130,7 @@ defineEmits<{
|
|
|
127
130
|
}>()
|
|
128
131
|
|
|
129
132
|
defineOptions({
|
|
130
|
-
inheritAttrs: false
|
|
133
|
+
inheritAttrs: false
|
|
131
134
|
})
|
|
132
135
|
</script>
|
|
133
136
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<slot v-bind="inputProps">
|
|
3
|
-
<div
|
|
3
|
+
<div
|
|
4
|
+
:class="$attrs.class"
|
|
5
|
+
@focusout="setRealDirty"
|
|
6
|
+
>
|
|
4
7
|
<OmegaInputVuetify
|
|
5
8
|
v-if="vuetified"
|
|
6
9
|
:input-props="inputProps"
|
|
@@ -11,31 +14,23 @@
|
|
|
11
14
|
</slot>
|
|
12
15
|
</template>
|
|
13
16
|
|
|
14
|
-
<script
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
nextTick,
|
|
26
|
-
} from "vue"
|
|
27
|
-
import type {
|
|
28
|
-
FieldValidators,
|
|
29
|
-
MetaRecord,
|
|
30
|
-
NestedKeyOf,
|
|
31
|
-
TypeOverride,
|
|
32
|
-
} from "./OmegaFormStuff"
|
|
17
|
+
<script
|
|
18
|
+
setup
|
|
19
|
+
lang="ts"
|
|
20
|
+
generic="
|
|
21
|
+
From extends Record<PropertyKey, any>,
|
|
22
|
+
Name extends DeepKeys<From>
|
|
23
|
+
"
|
|
24
|
+
>
|
|
25
|
+
import { type DeepKeys, useStore } from "@tanstack/vue-form"
|
|
26
|
+
import { computed, type ComputedRef, getCurrentInstance, nextTick, onMounted, ref, useId, watch, watchEffect } from "vue"
|
|
27
|
+
import type { InputProps, OmegaFieldInternalApi } from "./InputProps"
|
|
33
28
|
import { useOmegaErrors } from "./OmegaErrorsContext"
|
|
34
|
-
import type {
|
|
29
|
+
import type { FieldValidators, MetaRecord, NestedKeyOf, TypeOverride } from "./OmegaFormStuff"
|
|
35
30
|
import OmegaInputVuetify from "./OmegaInputVuetify.vue"
|
|
36
31
|
|
|
37
32
|
defineOptions({
|
|
38
|
-
inheritAttrs: false
|
|
33
|
+
inheritAttrs: false
|
|
39
34
|
})
|
|
40
35
|
|
|
41
36
|
const props = defineProps<{
|
|
@@ -54,7 +49,7 @@ const id = useId()
|
|
|
54
49
|
|
|
55
50
|
const fieldApi = props.field
|
|
56
51
|
|
|
57
|
-
const fieldState = useStore(fieldApi.store, state => state)
|
|
52
|
+
const fieldState = useStore(fieldApi.store, (state) => state)
|
|
58
53
|
|
|
59
54
|
const fieldType = computed(() => {
|
|
60
55
|
if (props.type) return props.type
|
|
@@ -68,7 +63,7 @@ const fieldType = computed(() => {
|
|
|
68
63
|
const fieldValue = computed(() => fieldState.value.value)
|
|
69
64
|
const errors = computed(() =>
|
|
70
65
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
-
fieldState.value.meta.errors.map((e: any) => e?.message).filter(Boolean)
|
|
66
|
+
fieldState.value.meta.errors.map((e: any) => e?.message).filter(Boolean)
|
|
72
67
|
)
|
|
73
68
|
|
|
74
69
|
const isFalsyButNotZero = (value: unknown): boolean => {
|
|
@@ -76,25 +71,27 @@ const isFalsyButNotZero = (value: unknown): boolean => {
|
|
|
76
71
|
}
|
|
77
72
|
|
|
78
73
|
// we remove value and errors when the field is empty and not required
|
|
79
|
-
//watchEffect will trigger infinite times with both free fieldValue and errors, so bet to watch a stupid boolean
|
|
74
|
+
// watchEffect will trigger infinite times with both free fieldValue and errors, so bet to watch a stupid boolean
|
|
80
75
|
watch(
|
|
81
76
|
() => !!fieldValue.value,
|
|
82
77
|
() => {
|
|
83
78
|
if (isFalsyButNotZero(fieldValue.value) && props.meta?.type !== "boolean") {
|
|
84
79
|
nextTick(() => {
|
|
85
80
|
fieldApi.setValue(
|
|
86
|
-
props.meta?.nullableOrUndefined === "undefined"
|
|
81
|
+
props.meta?.nullableOrUndefined === "undefined"
|
|
82
|
+
? undefined
|
|
83
|
+
: null as any
|
|
87
84
|
)
|
|
88
85
|
})
|
|
89
86
|
}
|
|
90
|
-
}
|
|
87
|
+
}
|
|
91
88
|
)
|
|
92
89
|
|
|
93
90
|
onMounted(() => {
|
|
94
91
|
if (
|
|
95
|
-
!fieldValue.value
|
|
96
|
-
!props.meta?.required
|
|
97
|
-
props.meta?.nullableOrUndefined === "null"
|
|
92
|
+
!fieldValue.value
|
|
93
|
+
&& !props.meta?.required
|
|
94
|
+
&& props.meta?.nullableOrUndefined === "null"
|
|
98
95
|
) {
|
|
99
96
|
fieldApi.setValue(null as any)
|
|
100
97
|
}
|
|
@@ -131,16 +128,19 @@ watch(
|
|
|
131
128
|
if (fieldState.value.meta.errors.length) {
|
|
132
129
|
addError({
|
|
133
130
|
inputId: id,
|
|
134
|
-
errors: fieldState
|
|
131
|
+
errors: fieldState
|
|
132
|
+
.value
|
|
133
|
+
.meta
|
|
134
|
+
.errors
|
|
135
135
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
136
136
|
.map((e: any) => e.message)
|
|
137
137
|
.filter(Boolean),
|
|
138
|
-
label: props.label
|
|
138
|
+
label: props.label
|
|
139
139
|
})
|
|
140
140
|
} else {
|
|
141
141
|
removeError(id)
|
|
142
142
|
}
|
|
143
|
-
}
|
|
143
|
+
}
|
|
144
144
|
)
|
|
145
145
|
|
|
146
146
|
const inputProps: ComputedRef<InputProps<From, Name>> = computed(() => ({
|
|
@@ -158,6 +158,6 @@ const inputProps: ComputedRef<InputProps<From, Name>> = computed(() => ({
|
|
|
158
158
|
setRealDirty,
|
|
159
159
|
type: fieldType.value,
|
|
160
160
|
label: `${props.label}${props.meta?.required ? " *" : ""}`,
|
|
161
|
-
options: props.options
|
|
161
|
+
options: props.options
|
|
162
162
|
}))
|
|
163
163
|
</script>
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<form
|
|
2
|
+
<form
|
|
3
|
+
novalidate
|
|
4
|
+
@submit.prevent.stop="formToUse.handleSubmit()"
|
|
5
|
+
>
|
|
3
6
|
<fieldset :disabled="formIsSubmitting">
|
|
4
7
|
<!-- Render externalForm + default slots if props.form is provided -->
|
|
5
8
|
<template v-if="props.form">
|
|
6
|
-
<slot
|
|
9
|
+
<slot
|
|
10
|
+
name="externalForm"
|
|
11
|
+
:subscribed-values="subscribedValues"
|
|
12
|
+
/>
|
|
7
13
|
<slot />
|
|
8
14
|
<!-- default slot -->
|
|
9
15
|
</template>
|
|
@@ -22,10 +28,11 @@
|
|
|
22
28
|
setup
|
|
23
29
|
lang="ts"
|
|
24
30
|
generic="
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
From extends Record<PropertyKey, any>,
|
|
32
|
+
To extends Record<PropertyKey, any>,
|
|
33
|
+
K extends keyof OmegaFormState<From, To> =
|
|
34
|
+
keyof OmegaFormState<From, To>
|
|
35
|
+
"
|
|
29
36
|
>
|
|
30
37
|
/**
|
|
31
38
|
* Form component that wraps TanStack Form's useForm hook
|
|
@@ -58,40 +65,31 @@
|
|
|
58
65
|
* </Form>
|
|
59
66
|
*/
|
|
60
67
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
61
|
-
import {
|
|
68
|
+
import { type StandardSchemaV1Issue, useStore } from "@tanstack/vue-form"
|
|
62
69
|
import { type S } from "effect-app"
|
|
63
|
-
import {
|
|
64
|
-
type FormProps,
|
|
65
|
-
type FilterItems,
|
|
66
|
-
type OmegaFormApi,
|
|
67
|
-
type OmegaFormState,
|
|
68
|
-
type ShowErrorsOn,
|
|
69
|
-
} from "./OmegaFormStuff"
|
|
70
|
+
import { computed, onBeforeMount, watch } from "vue"
|
|
70
71
|
import { getOmegaStore } from "./getOmegaStore"
|
|
71
72
|
import { provideOmegaErrors } from "./OmegaErrorsContext"
|
|
72
|
-
import {
|
|
73
|
-
|
|
74
|
-
type OmegaFormReturn,
|
|
75
|
-
useOmegaForm,
|
|
76
|
-
} from "./useOmegaForm"
|
|
77
|
-
import { computed, watch, onBeforeMount } from "vue"
|
|
73
|
+
import { type FilterItems, type FormProps, type OmegaFormApi, type OmegaFormState, type ShowErrorsOn } from "./OmegaFormStuff"
|
|
74
|
+
import { type OmegaConfig, type OmegaFormReturn, useOmegaForm } from "./useOmegaForm"
|
|
78
75
|
|
|
79
76
|
const props = defineProps<
|
|
80
|
-
{
|
|
77
|
+
& {
|
|
81
78
|
omegaConfig?: OmegaConfig<From>
|
|
82
79
|
subscribe?: K[]
|
|
83
80
|
showErrorsOn?: ShowErrorsOn
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
}
|
|
82
|
+
& FormProps<From, To>
|
|
83
|
+
& (
|
|
84
|
+
| {
|
|
85
|
+
form: OmegaFormReturn<From, To>
|
|
86
|
+
schema?: undefined
|
|
87
|
+
}
|
|
88
|
+
| {
|
|
89
|
+
form?: undefined
|
|
90
|
+
schema: S.Schema<To, From, never>
|
|
91
|
+
}
|
|
92
|
+
)
|
|
95
93
|
>()
|
|
96
94
|
|
|
97
95
|
const localForm = computed(() => {
|
|
@@ -113,61 +111,63 @@ onBeforeMount(() => {
|
|
|
113
111
|
"showErrorsOn",
|
|
114
112
|
"asyncAlways",
|
|
115
113
|
"form",
|
|
116
|
-
"schema"
|
|
114
|
+
"schema"
|
|
117
115
|
])
|
|
118
116
|
|
|
119
117
|
const filteredProps = Object.fromEntries(
|
|
120
118
|
Object.entries(props).filter(
|
|
121
119
|
([key, value]) =>
|
|
122
|
-
!excludedKeys.has(key as keyof typeof props) && value !== undefined
|
|
123
|
-
)
|
|
120
|
+
!excludedKeys.has(key as keyof typeof props) && value !== undefined
|
|
121
|
+
)
|
|
124
122
|
) as Partial<typeof props>
|
|
125
123
|
|
|
126
124
|
const propsKeys = Object.keys(filteredProps)
|
|
127
125
|
|
|
128
126
|
const overlappingKeys = formOptionsKeys.filter(
|
|
129
|
-
key =>
|
|
130
|
-
propsKeys.includes(key)
|
|
131
|
-
filteredProps[key as keyof typeof props] !== undefined
|
|
127
|
+
(key) =>
|
|
128
|
+
propsKeys.includes(key)
|
|
129
|
+
&& filteredProps[key as keyof typeof props] !== undefined
|
|
132
130
|
)
|
|
133
131
|
|
|
134
132
|
if (overlappingKeys.length > 0) {
|
|
135
133
|
console.warn(
|
|
136
|
-
`[OmegaWrapper] Overlapping keys found between form options and filtered props:\n${
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
`[OmegaWrapper] Overlapping keys found between form options and filtered props:\n${
|
|
135
|
+
overlappingKeys.join(
|
|
136
|
+
", \n"
|
|
137
|
+
)
|
|
138
|
+
}.\nProps will overwrite existing form options. This might indicate a configuration issue.`
|
|
139
139
|
)
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
const mergedOptions = {
|
|
143
143
|
...formToUse.value.options,
|
|
144
|
-
...filteredProps
|
|
144
|
+
...filteredProps
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
formToUse.value.options = Object.fromEntries(
|
|
148
148
|
// TODO
|
|
149
149
|
(Object.entries(mergedOptions) as any).filter(
|
|
150
|
-
([_, value]: any) => value !== undefined
|
|
151
|
-
)
|
|
150
|
+
([_, value]: any) => value !== undefined
|
|
151
|
+
)
|
|
152
152
|
)
|
|
153
153
|
})
|
|
154
154
|
|
|
155
155
|
const formIsSubmitting = useStore(
|
|
156
156
|
formToUse.value.store,
|
|
157
|
-
state => state.isSubmitting
|
|
157
|
+
(state) => state.isSubmitting
|
|
158
158
|
)
|
|
159
159
|
|
|
160
160
|
const subscribedValues = getOmegaStore(
|
|
161
161
|
formToUse.value as unknown as OmegaFormApi<From, To>,
|
|
162
|
-
props.subscribe
|
|
162
|
+
props.subscribe
|
|
163
163
|
)
|
|
164
164
|
|
|
165
165
|
const formSubmissionAttempts = useStore(
|
|
166
166
|
formToUse.value.store,
|
|
167
|
-
state => state.submissionAttempts
|
|
167
|
+
(state) => state.submissionAttempts
|
|
168
168
|
)
|
|
169
169
|
|
|
170
|
-
const errors = computed(() => formToUse.value.useStore(state => state.errors))
|
|
170
|
+
const errors = computed(() => formToUse.value.useStore((state) => state.errors))
|
|
171
171
|
|
|
172
172
|
watch(
|
|
173
173
|
() => [formToUse.value.filterItems, errors.value.value],
|
|
@@ -176,18 +176,20 @@ watch(
|
|
|
176
176
|
const currentErrors = errors.value.value
|
|
177
177
|
if (!filterItems) return {}
|
|
178
178
|
if (!currentErrors) return {}
|
|
179
|
-
const errorList = Object
|
|
179
|
+
const errorList = Object
|
|
180
|
+
.values(currentErrors)
|
|
180
181
|
.filter(
|
|
181
182
|
(fieldErrors): fieldErrors is Record<string, StandardSchemaV1Issue[]> =>
|
|
182
|
-
Boolean(fieldErrors)
|
|
183
|
+
Boolean(fieldErrors)
|
|
183
184
|
)
|
|
184
|
-
.flatMap(fieldErrors =>
|
|
185
|
-
Object
|
|
185
|
+
.flatMap((fieldErrors) =>
|
|
186
|
+
Object
|
|
187
|
+
.values(fieldErrors)
|
|
186
188
|
.flat()
|
|
187
|
-
.map((issue: StandardSchemaV1Issue) => issue.message)
|
|
189
|
+
.map((issue: StandardSchemaV1Issue) => issue.message)
|
|
188
190
|
)
|
|
189
191
|
|
|
190
|
-
if (errorList.some(e => e === filterItems.message)) {
|
|
192
|
+
if (errorList.some((e) => e === filterItems.message)) {
|
|
191
193
|
// TODO: Investigate if filterItems.items should be typed based on DeepKeys<To>.
|
|
192
194
|
filterItems.items.forEach((item: keyof From) => {
|
|
193
195
|
const m = formToUse.value.getFieldMeta(item as any)
|
|
@@ -196,15 +198,15 @@ watch(
|
|
|
196
198
|
...m,
|
|
197
199
|
errorMap: {
|
|
198
200
|
onSubmit: [
|
|
199
|
-
{ path: [item as string], message: filterItems.message }
|
|
200
|
-
]
|
|
201
|
-
}
|
|
201
|
+
{ path: [item as string], message: filterItems.message }
|
|
202
|
+
]
|
|
203
|
+
}
|
|
202
204
|
})
|
|
203
205
|
}
|
|
204
206
|
})
|
|
205
207
|
}
|
|
206
208
|
return {}
|
|
207
|
-
}
|
|
209
|
+
}
|
|
208
210
|
)
|
|
209
211
|
|
|
210
212
|
provideOmegaErrors(formSubmissionAttempts, errors.value, props.showErrorsOn)
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { useStore } from "@tanstack/vue-form"
|
|
2
|
-
import { type Ref
|
|
3
|
-
import type {
|
|
2
|
+
import { computed, type Ref } from "vue"
|
|
3
|
+
import type { OmegaFormApi, OmegaFormState } from "./OmegaFormStuff"
|
|
4
4
|
|
|
5
5
|
export function getOmegaStore<
|
|
6
6
|
To,
|
|
7
7
|
From,
|
|
8
|
-
K extends keyof OmegaFormState<To, From> = keyof OmegaFormState<To, From
|
|
8
|
+
K extends keyof OmegaFormState<To, From> = keyof OmegaFormState<To, From>
|
|
9
9
|
>(
|
|
10
10
|
form: OmegaFormApi<To, From>,
|
|
11
|
-
subscribe?: K[]
|
|
11
|
+
subscribe?: K[]
|
|
12
12
|
): Ref<
|
|
13
|
-
K[] extends undefined[]
|
|
14
|
-
? Record<string, never>
|
|
13
|
+
K[] extends undefined[] ? Record<string, never>
|
|
15
14
|
: Pick<OmegaFormState<To, From>, K>
|
|
16
15
|
> {
|
|
17
16
|
return computed(() => {
|
|
18
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
18
|
if (!subscribe) return {} as any
|
|
20
19
|
|
|
21
|
-
const state = useStore(form.store, state => {
|
|
20
|
+
const state = useStore(form.store, (state) => {
|
|
22
21
|
const result = {} as Pick<OmegaFormState<To, From>, K>
|
|
23
22
|
for (const key of subscribe) {
|
|
24
23
|
result[key] = state[key]
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { default as OmegaForm } from "./OmegaWrapper.vue"
|
|
2
|
-
import { default as OmegaInput } from "./OmegaInput.vue"
|
|
3
|
-
import { default as OmegaFormInput } from "./OmegaFormInput.vue"
|
|
4
|
-
import { default as OmegaErrors } from "./OmegaErrors.vue"
|
|
5
|
-
import { default as OmegaAutoGen } from "./OmegaAutoGen.vue"
|
|
6
1
|
import { default as OmegaArray } from "./OmegaArray.vue"
|
|
2
|
+
import { default as OmegaAutoGen } from "./OmegaAutoGen.vue"
|
|
3
|
+
import { default as OmegaErrors } from "./OmegaErrors.vue"
|
|
4
|
+
import { default as OmegaFormInput } from "./OmegaFormInput.vue"
|
|
5
|
+
import { default as OmegaInput } from "./OmegaInput.vue"
|
|
6
|
+
import { default as OmegaForm } from "./OmegaWrapper.vue"
|
|
7
7
|
|
|
8
8
|
export * as OmegaErrorsContext from "./OmegaErrorsContext"
|
|
9
9
|
export * from "./OmegaFormStuff"
|
|
10
|
-
export { useOmegaForm, type OmegaFormReturn } from "./useOmegaForm"
|
|
11
10
|
export { default } from "./OmegaWrapper.vue"
|
|
11
|
+
export { type OmegaFormReturn, useOmegaForm } from "./useOmegaForm"
|
|
12
12
|
|
|
13
|
-
export {
|
|
13
|
+
export { OmegaArray, OmegaAutoGen, OmegaErrors, OmegaForm, OmegaFormInput, OmegaInput }
|