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 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
- * Defines the strategy for when validation checks are executed.
9
- * - 'lazy': Validation occurs only on blur or form submission.
10
- * - 'eager': Validation occurs immediately on every value change.
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 (mode === "eager" || validateOn.includes("blur")) validate();
127
+ if (!validateOn.includes("blur")) return;
128
+ validate();
128
129
  },
129
130
  onChange: function() {
130
131
  dirtyField(props.name);
131
- if (mode === "eager" || validateOn.includes("change")) validate();
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 (mode === "eager" || validateOn.includes("input")) validate();
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
- dirtyField(props.name);
139
- if (mode === "eager" || validateOn.includes("focus")) validate();
143
+ if (!validateOn.includes("focus")) return;
144
+ validate();
140
145
  }
141
146
  }
142
147
  });
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "1.0.0",
8
+ "version": "1.0.1",
9
9
  "description": "Vue Forms Without the Friction",
10
10
  "author": "Favour Emeka <favorodera@gmail.com>",
11
11
  "license": "MIT",