notform 1.0.2 → 1.0.4

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
@@ -153,6 +153,8 @@ type NotFormContext<TSchema extends ObjectSchema> = {
153
153
  reset: (_state?: DeepPartial<StandardSchemaV1.InferInput<TSchema>>, _errors?: StandardSchemaV1.Issue[], _validate?: boolean) => void;
154
154
  /** Reactive status of async validation process */
155
155
  isValidating: Ref<boolean>;
156
+ /** Reactive status of form submission */
157
+ isSubmitting: Ref<boolean>;
156
158
  /** Computed status of form validity */
157
159
  isValid: ComputedRef<boolean>;
158
160
  /** Computed status of field interactions */
package/dist/index.js CHANGED
@@ -411,6 +411,7 @@ function useNotForm(options) {
411
411
  state: ref(structuredClone(initialState)),
412
412
  errors: ref([...initialErrors]),
413
413
  isValidating: ref(false),
414
+ isSubmitting: ref(false),
414
415
  touchedFields: ref(/* @__PURE__ */ new Set()),
415
416
  dirtyFields: ref(/* @__PURE__ */ new Set()),
416
417
  isValid: computed(() => context.errors.value.length === 0),
@@ -495,9 +496,8 @@ function useNotForm(options) {
495
496
  getObjectPaths(_state).forEach((path) => {
496
497
  context.dirtyFields.value.add(path);
497
498
  context.touchedFields.value.add(path);
498
- context.validateField(path);
499
+ if (_validate) context.validateField(path);
499
500
  });
500
- if (_validate) context.validate();
501
501
  },
502
502
  setErrors(_errors) {
503
503
  context.errors.value = [...context.errors.value, ..._errors];
@@ -524,6 +524,7 @@ function useNotForm(options) {
524
524
  context.dirtyFields.value = new Set(paths);
525
525
  },
526
526
  async submit(event) {
527
+ context.isSubmitting.value = true;
527
528
  try {
528
529
  context.touchAllFields();
529
530
  context.dirtyAllFields();
@@ -545,6 +546,8 @@ function useNotForm(options) {
545
546
  message: "An unexpected error occurred during submission",
546
547
  path: []
547
548
  }]);
549
+ } finally {
550
+ context.isSubmitting.value = false;
548
551
  }
549
552
  }
550
553
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "1.0.2",
8
+ "version": "1.0.4",
9
9
  "description": "Vue Forms Without the Friction",
10
10
  "author": "Favour Emeka <favorodera@gmail.com>",
11
11
  "license": "MIT",