@tmagic/form 1.3.7 → 1.3.8

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.
@@ -1433,6 +1433,15 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1433
1433
  tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
1434
1434
  return;
1435
1435
  }
1436
+ if (typeof props.config.beforeAddRow === "function") {
1437
+ const beforeCheckRes = props.config.beforeAddRow(mForm, {
1438
+ model: props.model[modelName.value],
1439
+ formValue: mForm?.values,
1440
+ prop: props.prop
1441
+ });
1442
+ if (!beforeCheckRes)
1443
+ return;
1444
+ }
1436
1445
  const columns = props.config.items;
1437
1446
  const enumValues = props.config.enum || [];
1438
1447
  let enumV = [];
@@ -2788,7 +2797,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2788
2797
  popperClass: {},
2789
2798
  extendState: {}
2790
2799
  },
2791
- emits: ["change", "field-input", "field-change"],
2800
+ emits: ["change", "error", "field-input", "field-change"],
2792
2801
  setup(__props, { expose: __expose, emit: __emit }) {
2793
2802
  const props = __props;
2794
2803
  const emit = __emit;
@@ -2878,6 +2887,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2878
2887
  await tMagicForm.value?.validate();
2879
2888
  return native ? values.value : cloneDeep(toRaw(values.value));
2880
2889
  } catch (invalidFields) {
2890
+ emit("error", invalidFields);
2881
2891
  const error = [];
2882
2892
  Object.entries(invalidFields).forEach(([, ValidateError]) => {
2883
2893
  ValidateError.forEach(({ field, message }) => {