vue3-form-validation
Advanced tools
Comparing version 4.0.3 to 4.0.4
import { isReactive } from 'vue'; | ||
import { deepIterator } from '../../deep-iterator/deepIterator'; | ||
import { jsonCopy } from '../../json-copy/jsonCopy'; | ||
import { deepCopy } from '../../deep-copy/deep-copy'; | ||
import { set } from '../../set/set'; | ||
@@ -11,3 +11,3 @@ import { isTransformedField } from '../../type-guards/typeGuards'; | ||
if (isReactive(value.$value)) { | ||
set(result, path, jsonCopy(value.$value)); | ||
set(result, path, deepCopy(value.$value)); | ||
} | ||
@@ -20,3 +20,3 @@ else { | ||
if (isReactive(value)) { | ||
set(result, path, jsonCopy(value)); | ||
set(result, path, deepCopy(value)); | ||
} | ||
@@ -23,0 +23,0 @@ else { |
@@ -1,2 +0,2 @@ | ||
import { jsonCopy } from '../../json-copy/jsonCopy'; | ||
import { deepCopy } from '../../deep-copy/deep-copy'; | ||
import { isArray, isObject, isTransformedField } from '../../type-guards/typeGuards'; | ||
@@ -8,6 +8,6 @@ export function resetFields(formData, transformedFormData) { | ||
if (isArray(transformedValue.$value)) { | ||
transformedValue.$value = jsonCopy(value); | ||
transformedValue.$value = deepCopy(value); | ||
} | ||
else if (isObject(transformedValue.$value)) { | ||
const copy = jsonCopy(value); | ||
const copy = deepCopy(value); | ||
Object.assign(transformedValue.$value, copy); | ||
@@ -14,0 +14,0 @@ } |
import { computed, isReactive, isRef, reactive, ref, unref } from 'vue'; | ||
import { isArray, isObject, isDefined } from '../common'; | ||
import { jsonCopy } from '../common/json-copy/jsonCopy'; | ||
import { deepCopy } from '../common/deep-copy/deep-copy'; | ||
export class FormField { | ||
@@ -15,11 +15,11 @@ constructor(name, modelValue, rules) { | ||
this.modelValue = modelValue; | ||
this._initialModelValue = jsonCopy(unref(modelValue)); | ||
this._initialModelValue = deepCopy(unref(modelValue)); | ||
} | ||
else if (isObject(modelValue)) { | ||
this.modelValue = reactive(modelValue); | ||
this._initialModelValue = jsonCopy(this.modelValue); | ||
this._initialModelValue = deepCopy(this.modelValue); | ||
} | ||
else { | ||
this.modelValue = ref(modelValue); | ||
this._initialModelValue = jsonCopy(unref(modelValue)); | ||
this._initialModelValue = deepCopy(unref(modelValue)); | ||
} | ||
@@ -35,3 +35,3 @@ } | ||
if (isArray(this.modelValue.value)) { | ||
this.modelValue.value = jsonCopy(this._initialModelValue); | ||
this.modelValue.value = deepCopy(this._initialModelValue); | ||
} | ||
@@ -43,3 +43,3 @@ else { | ||
else { | ||
const copy = jsonCopy(this._initialModelValue); | ||
const copy = deepCopy(this._initialModelValue); | ||
Object.assign(this.modelValue, copy); | ||
@@ -46,0 +46,0 @@ } |
{ | ||
"name": "vue3-form-validation", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"description": "Vue composition function for Form Validation", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -148,3 +148,3 @@ # Form Validation for Vue 3 | ||
- `names?` - Field names to validate. | ||
- **Returns** - A `Promise` which will reject if there are validation errors, and resolve with the form data otherwise. Will throw `ValidationError` which you can compare against using `instanceof`. | ||
- **Returns** - A `Promise` which will reject if there are validation errors, and resolve with the form data otherwise. The error in the rejected `Promise` will be of type `ValidationError`. | ||
- `resetFields(formData?: object) -> void` | ||
@@ -151,0 +151,0 @@ - **Description** - Reset all fields to their original value, or pass an object to set specific values. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43148
895