@geomak/ui 7.5.0 → 7.5.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.cts CHANGED
@@ -4746,7 +4746,10 @@ declare class FormStore {
4746
4746
  errors: ErrorMap;
4747
4747
  touched: Record<string, boolean>;
4748
4748
  submitted: boolean;
4749
+ /** True while async field validation runs. */
4749
4750
  validating: boolean;
4751
+ /** True while the submit handler (`onFinish` / `action`) is executing. */
4752
+ submitting: boolean;
4750
4753
  readonly initialValues: FormValues;
4751
4754
  private rules;
4752
4755
  readonly validateOn: ValidateTrigger[];
@@ -4778,6 +4781,7 @@ declare class FormStore {
4778
4781
  validate?: boolean;
4779
4782
  }) => void;
4780
4783
  setSubmitted: (v: boolean) => void;
4784
+ setSubmitting: (v: boolean) => void;
4781
4785
  validateField(name: string): Promise<string | undefined>;
4782
4786
  validateAll(): Promise<ErrorMap>;
4783
4787
  reset: (values?: FormValues) => void;
package/dist/index.d.ts CHANGED
@@ -4746,7 +4746,10 @@ declare class FormStore {
4746
4746
  errors: ErrorMap;
4747
4747
  touched: Record<string, boolean>;
4748
4748
  submitted: boolean;
4749
+ /** True while async field validation runs. */
4749
4750
  validating: boolean;
4751
+ /** True while the submit handler (`onFinish` / `action`) is executing. */
4752
+ submitting: boolean;
4750
4753
  readonly initialValues: FormValues;
4751
4754
  private rules;
4752
4755
  readonly validateOn: ValidateTrigger[];
@@ -4778,6 +4781,7 @@ declare class FormStore {
4778
4781
  validate?: boolean;
4779
4782
  }) => void;
4780
4783
  setSubmitted: (v: boolean) => void;
4784
+ setSubmitting: (v: boolean) => void;
4781
4785
  validateField(name: string): Promise<string | undefined>;
4782
4786
  validateAll(): Promise<ErrorMap>;
4783
4787
  reset: (values?: FormValues) => void;
package/dist/index.js CHANGED
@@ -3511,7 +3511,10 @@ var FormStore = class {
3511
3511
  errors = {};
3512
3512
  touched = {};
3513
3513
  submitted = false;
3514
+ /** True while async field validation runs. */
3514
3515
  validating = false;
3516
+ /** True while the submit handler (`onFinish` / `action`) is executing. */
3517
+ submitting = false;
3515
3518
  initialValues;
3516
3519
  rules;
3517
3520
  validateOn;
@@ -3596,6 +3599,10 @@ var FormStore = class {
3596
3599
  this.submitted = v;
3597
3600
  this.emit();
3598
3601
  };
3602
+ setSubmitting = (v) => {
3603
+ this.submitting = v;
3604
+ this.emit();
3605
+ };
3599
3606
  // ── validation ─────────────────────────────────────────────────────────────
3600
3607
  async validateField(name) {
3601
3608
  const err = await runFieldRules(getPath(this.values, name), this.rules[name], this.values);
@@ -3621,6 +3628,7 @@ var FormStore = class {
3621
3628
  this.errors = {};
3622
3629
  this.touched = {};
3623
3630
  this.submitted = false;
3631
+ this.submitting = false;
3624
3632
  this.keys = {};
3625
3633
  this.fieldCache.clear();
3626
3634
  this.emit();
@@ -3720,7 +3728,8 @@ function useForm(options = {}) {
3720
3728
  errors: store.errors,
3721
3729
  touched: store.touched,
3722
3730
  submitted: store.submitted,
3723
- isSubmitting: store.validating,
3731
+ // True for the whole submit cycle: async validation → onFinish execution.
3732
+ isSubmitting: store.submitting || store.validating,
3724
3733
  isValid: store.isValid,
3725
3734
  getValue: store.getValue,
3726
3735
  getValues: store.getValues,
@@ -3770,7 +3779,12 @@ function Form({
3770
3779
  return;
3771
3780
  }
3772
3781
  if (onFinish) {
3773
- await onFinish(store.getValues());
3782
+ store.setSubmitting(true);
3783
+ try {
3784
+ await onFinish(store.getValues());
3785
+ } finally {
3786
+ store.setSubmitting(false);
3787
+ }
3774
3788
  return;
3775
3789
  }
3776
3790
  if (typeof action === "function") {