tsv2-library 1.0.61-beta.72 → 1.0.61-beta.74

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.
@@ -120,6 +120,14 @@ declare class Form extends ClassComponent<FormProps, FormSlots, FormEmits> {
120
120
  * Clears the form fields.
121
121
  */
122
122
  clearField: () => void;
123
+ /**
124
+ * Sets the errors for the form fields.
125
+ */
126
+ setErrors: (errors: Partial<Record<string, string | undefined>>) => void;
127
+ /**
128
+ * Sets the error for a specific field.
129
+ */
130
+ setFieldError: (field: string, error: string | undefined) => void;
123
131
  }
124
132
 
125
133
  declare module '@vue/runtime-core' {
@@ -68443,8 +68443,11 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
68443
68443
  setDialogClass();
68444
68444
  }
68445
68445
  });
68446
- const { handleSubmit, values, resetForm, errors } = useForm$1();
68447
- const isSubmitting = shallowRef(false);
68446
+ const { handleSubmit, values, resetForm, errors, setErrors, setFieldError } = useForm$1();
68447
+ const isSubmitting = inject(
68448
+ "isSubmitting",
68449
+ shallowRef(false)
68450
+ );
68448
68451
  provide("isSubmitting", isSubmitting);
68449
68452
  const formState = shallowRef("submit");
68450
68453
  const formElement = ref();
@@ -68539,7 +68542,9 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
68539
68542
  formElement,
68540
68543
  clearField,
68541
68544
  errors,
68542
- values
68545
+ values,
68546
+ setErrors,
68547
+ setFieldError
68543
68548
  });
68544
68549
  return (_ctx, _cache) => {
68545
68550
  var _a, _b, _c, _d, _e, _f;
@@ -68696,6 +68701,8 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
68696
68701
  const props = __props;
68697
68702
  const emit = __emit;
68698
68703
  const slots = useSlots();
68704
+ const isSubmitting = shallowRef(false);
68705
+ provide("isSubmitting", isSubmitting);
68699
68706
  const form = ref();
68700
68707
  const dialogForm = ref();
68701
68708
  const fieldsKey = ref(0);
@@ -68713,9 +68720,14 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
68713
68720
  emit("update:visible", false);
68714
68721
  emit("close");
68715
68722
  };
68716
- const onButtonSubmitClicked = () => {
68723
+ const onButtonSubmitClicked = async () => {
68717
68724
  if (form.value && !props.invalid && !props.validatorMessage) {
68718
- form.value.submit();
68725
+ isSubmitting.value = true;
68726
+ try {
68727
+ await form.value.submit();
68728
+ } finally {
68729
+ isSubmitting.value = false;
68730
+ }
68719
68731
  }
68720
68732
  };
68721
68733
  const clearField = () => {