notform 1.0.0 → 1.0.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/index.d.ts +3 -3
- package/dist/index.js +10 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { PartialDeep, Paths as Paths$1 } from "type-fest";
|
|
|
5
5
|
|
|
6
6
|
//#region src/types/shared.d.ts
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
8
|
+
* Validation execution strategy.
|
|
9
|
+
* - `lazy`: Validates on blur or submission.
|
|
10
|
+
* - `eager`: Validates on blur, then on every change if an error exists.
|
|
11
11
|
*/
|
|
12
12
|
type ValidationMode = 'lazy' | 'eager';
|
|
13
13
|
/**
|
package/dist/index.js
CHANGED
|
@@ -124,19 +124,24 @@ var not_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
124
124
|
methods: {
|
|
125
125
|
onBlur: function() {
|
|
126
126
|
touchField(props.name);
|
|
127
|
-
if (
|
|
127
|
+
if (!validateOn.includes("blur")) return;
|
|
128
|
+
validate();
|
|
128
129
|
},
|
|
129
130
|
onChange: function() {
|
|
130
131
|
dirtyField(props.name);
|
|
131
|
-
if (
|
|
132
|
+
if (!validateOn.includes("change")) return;
|
|
133
|
+
if (mode === "lazy") return;
|
|
134
|
+
if (mode === "eager" && getFieldErrors(props.name).length > 0) validate();
|
|
132
135
|
},
|
|
133
136
|
onInput: function() {
|
|
134
137
|
dirtyField(props.name);
|
|
135
|
-
if (
|
|
138
|
+
if (!validateOn.includes("input")) return;
|
|
139
|
+
if (mode === "lazy") return;
|
|
140
|
+
if (mode === "eager" && getFieldErrors(props.name).length > 0) validate();
|
|
136
141
|
},
|
|
137
142
|
onFocus: function() {
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
if (!validateOn.includes("focus")) return;
|
|
144
|
+
validate();
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
147
|
});
|