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