@effect-app/vue-components 2.5.0 → 2.6.1
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/vue-components.es10.js +123 -115
- package/dist/vue-components.es12.js +14 -14
- package/dist/vue-components.es22.js +1 -1
- package/dist/vue-components.es23.js +1 -1
- package/dist/vue-components.es36.js +1 -1
- package/dist/vue-components.es40.js +23 -4
- package/dist/vue-components.es41.js +5 -23
- package/dist/vue-components.es42.js +21 -5
- package/dist/vue-components.es43.js +25 -16
- package/dist/vue-components.es44.js +15 -23
- package/dist/vue-components.es45.js +7 -17
- package/dist/vue-components.es46.js +5 -12
- package/dist/vue-components.es47.js +19 -5
- package/dist/vue-components.es48.js +9 -19
- package/dist/vue-components.es49.js +31 -9
- package/dist/vue-components.es50.js +42 -25
- package/dist/vue-components.es51.js +16 -38
- package/dist/vue-components.es52.js +11 -26
- package/dist/vue-components.es53.js +4 -11
- package/dist/vue-components.es54.js +1 -1
- package/dist/vue-components.es56.js +1 -1
- package/dist/vue-components.es58.js +3 -3
- package/dist/vue-components.es59.js +1 -1
- package/dist/vue-components.es7.js +24 -24
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaFormStuff.ts +8 -8
- package/src/components/OmegaForm/OmegaInternalInput.vue +6 -2
- package/src/components/OmegaForm/useOmegaForm.ts +17 -5
|
@@ -677,7 +677,8 @@ export const useOmegaForm = <
|
|
|
677
677
|
// Normalize default values based on schema metadata
|
|
678
678
|
// Convert empty strings to null/undefined for nullable fields
|
|
679
679
|
// Also initialize missing nullable fields with null/undefined
|
|
680
|
-
const normalizeDefaultValues = (values
|
|
680
|
+
const normalizeDefaultValues = (values?: Partial<From>): Partial<From> | undefined => {
|
|
681
|
+
if (!values) return undefined
|
|
681
682
|
const normalized: any = { ...values }
|
|
682
683
|
|
|
683
684
|
// Process all fields in the schema metadata
|
|
@@ -705,11 +706,22 @@ export const useOmegaForm = <
|
|
|
705
706
|
return normalized
|
|
706
707
|
}
|
|
707
708
|
|
|
709
|
+
// Extract default values from schema constructors (e.g., withDefaultConstructor)
|
|
710
|
+
const extractSchemaDefaults = (defaultValues: Partial<From> = {}) => {
|
|
711
|
+
try {
|
|
712
|
+
// Note: Partial schemas don't have .make() method yet (https://github.com/Effect-TS/effect/issues/4222)
|
|
713
|
+
if ("make" in schema && typeof (schema as any).make === "function") {
|
|
714
|
+
return (schema as any).make(defaultValues, { disableValidation: true })
|
|
715
|
+
}
|
|
716
|
+
} catch (error) {
|
|
717
|
+
console.warn("Could not extract schema constructor defaults:", error)
|
|
718
|
+
return {}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
708
722
|
const defaultValues = computed(() => {
|
|
709
723
|
// Normalize tanstack default values at the beginning
|
|
710
|
-
const normalizedTanstackDefaults = tanstackFormOptions?.defaultValues
|
|
711
|
-
? normalizeDefaultValues(tanstackFormOptions.defaultValues)
|
|
712
|
-
: undefined
|
|
724
|
+
const normalizedTanstackDefaults = extractSchemaDefaults(normalizeDefaultValues(tanstackFormOptions?.defaultValues))
|
|
713
725
|
|
|
714
726
|
if (
|
|
715
727
|
normalizedTanstackDefaults
|
|
@@ -764,7 +776,7 @@ export const useOmegaForm = <
|
|
|
764
776
|
}
|
|
765
777
|
|
|
766
778
|
// to be sure we have a valid object at the end of the gathering process
|
|
767
|
-
defValuesPatch ??= {}
|
|
779
|
+
defValuesPatch ??= extractSchemaDefaults({})
|
|
768
780
|
|
|
769
781
|
if (!normalizedTanstackDefaults) {
|
|
770
782
|
// we just return what we gathered from the query/storage
|