@yibozhang/pro-table 16.1.7 → 16.1.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.
- package/esm2022/lib/page-public/antd-form.mjs +21 -3
- package/esm2022/lib/pro-table.component.mjs +1 -2
- package/fesm2022/yibozhang-pro-table.mjs +20 -3
- package/fesm2022/yibozhang-pro-table.mjs.map +1 -1
- package/lib/page-public/antd-form.d.ts +1 -0
- package/lib/page-public/antd-form.d.ts.map +1 -1
- package/lib/pro-table.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -827,7 +827,6 @@ class ProTableComponent {
|
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
async ngOnInit() {
|
|
830
|
-
console.log('aaa');
|
|
831
830
|
this._searchParams = {};
|
|
832
831
|
this.formateInnerColumns(this.columns);
|
|
833
832
|
await this.setSearchParams(this.columns);
|
|
@@ -2039,6 +2038,7 @@ class AntdFormService {
|
|
|
2039
2038
|
// ==================== 构造函数 ====================
|
|
2040
2039
|
constructor(fb) {
|
|
2041
2040
|
this.fb = fb;
|
|
2041
|
+
console.log('aaaaaaa');
|
|
2042
2042
|
}
|
|
2043
2043
|
// ==================== 表单创建和初始化 ====================
|
|
2044
2044
|
// 判断是否为嵌套 FormGroup 配置
|
|
@@ -2528,8 +2528,9 @@ class AntdFormService {
|
|
|
2528
2528
|
if (!control.errors) {
|
|
2529
2529
|
return "";
|
|
2530
2530
|
}
|
|
2531
|
-
// 从 errorMessageStore
|
|
2532
|
-
const errorMessages = this.errorMessageStore[name]?.[controlName]
|
|
2531
|
+
// 从 errorMessageStore 获取错误消息配置,回退查找 arrayItemConfigs
|
|
2532
|
+
const errorMessages = this.errorMessageStore[name]?.[controlName]
|
|
2533
|
+
?? this._getArrayItemErrorMessages(name, controlName);
|
|
2533
2534
|
const mergedMessages = {
|
|
2534
2535
|
...this.defaultErrorMessages,
|
|
2535
2536
|
...(errorMessages ?? {}),
|
|
@@ -2666,6 +2667,22 @@ class AntdFormService {
|
|
|
2666
2667
|
}
|
|
2667
2668
|
this.arrayItemConfigs[formName][arrayPath] = itemConfig;
|
|
2668
2669
|
}
|
|
2670
|
+
_getArrayItemErrorMessages(formName, controlName) {
|
|
2671
|
+
const parts = controlName.split('.');
|
|
2672
|
+
if (parts.length < 3)
|
|
2673
|
+
return undefined;
|
|
2674
|
+
const maybeIndex = parts[parts.length - 2];
|
|
2675
|
+
if (!/^\d+$/.test(maybeIndex))
|
|
2676
|
+
return undefined;
|
|
2677
|
+
const fieldName = parts[parts.length - 1];
|
|
2678
|
+
const arrayPath = parts.slice(0, -2).join('.');
|
|
2679
|
+
const itemConfig = this.arrayItemConfigs[formName]?.[arrayPath];
|
|
2680
|
+
const fieldConfig = itemConfig?.[fieldName];
|
|
2681
|
+
if (!fieldConfig || this.isFormGroupConfig(fieldConfig) || this.isFormArrayConfig(fieldConfig)) {
|
|
2682
|
+
return undefined;
|
|
2683
|
+
}
|
|
2684
|
+
return fieldConfig.errorMessages;
|
|
2685
|
+
}
|
|
2669
2686
|
// 初始化 arrayEditingRows 和 arrayRowSnapshots 对应路径(若不存在则创建)
|
|
2670
2687
|
_ensureArrayState(formName, arrayPath) {
|
|
2671
2688
|
if (!this.arrayEditingRows[formName]) {
|