|
@@ -258,10 +258,19 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- // All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
|
|
|
|
- // input => output:
|
|
|
|
- // a => a[0]、a[1]
|
|
|
|
- // b => b.type、b.name[3]、b.name[2]
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Case A:
|
|
|
|
+ * All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
|
|
|
|
+ * input => output:
|
|
|
|
+ * a => a[0]、a[1]
|
|
|
|
+ * b => b.type、b.name[0]、b.name[2]
|
|
|
|
+ *
|
|
|
|
+ * Case B:
|
|
|
|
+ * All fields: activity.a[0]、activity.a[1]、activity.c、activity.d、other
|
|
|
|
+ * input => output:
|
|
|
|
+ * activity.a => activity.a[0]、activity.a[1]
|
|
|
|
+ *
|
|
|
|
+ */
|
|
_getNestedField(path: string): Map<string, FieldStaff> {
|
|
_getNestedField(path: string): Map<string, FieldStaff> {
|
|
const allRegisterField = this.fields;
|
|
const allRegisterField = this.fields;
|
|
const allFieldPath = [...allRegisterField].map(item => item[0]);
|
|
const allFieldPath = [...allRegisterField].map(item => item[0]);
|
|
@@ -269,7 +278,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
allFieldPath.forEach(item => {
|
|
allFieldPath.forEach(item => {
|
|
let itemPath = toPath(item);
|
|
let itemPath = toPath(item);
|
|
let targetPath = toPath(path);
|
|
let targetPath = toPath(path);
|
|
- if (itemPath[0] === targetPath[0]) {
|
|
|
|
|
|
+ if (targetPath.every((path, i) => (targetPath[i] === itemPath[i]))) {
|
|
const realField = allRegisterField.get(item);
|
|
const realField = allRegisterField.get(item);
|
|
nestedFieldPath.set(item, realField);
|
|
nestedFieldPath.set(item, realField);
|
|
}
|
|
}
|