fixed bug on toc error indicator, on nested sections
This commit is contained in:
parent
6e73dd66df
commit
9a8ddfa7ea
|
@ -1098,10 +1098,11 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
|
||||
page.sections?.forEach((section: DescriptionTemplateSection) => {
|
||||
let fieldsets = this.getNestedSectionFieldsets(section);
|
||||
let sectionIds = this.getNestedSectionIds(section);
|
||||
let fieldsBySection: DescriptionFieldIndicator[] = fieldsets?.flatMap((fieldset: DescriptionTemplateFieldSet) =>
|
||||
fieldset.fields?.flatMap((field: DescriptionTemplateField) =>
|
||||
new DescriptionFieldIndicator(page.id, sectionIds, fieldset.id, field.id, field.data.fieldType, field.data.multipleSelect)
|
||||
fieldset.fields?.flatMap((field: DescriptionTemplateField) => {
|
||||
let sectionIds = this.getNestedSectionIdsByField(section, fieldset.id);
|
||||
return new DescriptionFieldIndicator(page.id, sectionIds, fieldset.id, field.id, field.data.fieldType, field.data.multipleSelect)
|
||||
}
|
||||
));
|
||||
|
||||
fieldsByPage.push(...fieldsBySection);
|
||||
|
@ -1118,12 +1119,14 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
else return section.fieldSets;
|
||||
}
|
||||
|
||||
getNestedSectionIds(section: DescriptionTemplateSection): string[] {
|
||||
getNestedSectionIdsByField(section: DescriptionTemplateSection, fieldSetId: string): string[] {
|
||||
if (section.sections) {
|
||||
return [section.id, ...section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIds(subsection))];
|
||||
return [section.id, ...section.sections.flatMap((subsection: DescriptionTemplateSection) => this.getNestedSectionIdsByField(subsection, fieldSetId))];
|
||||
}
|
||||
|
||||
else return [section.id];
|
||||
else if (section.fieldSets.find(fieldSet => fieldSet.id == fieldSetId)) return [section.id];
|
||||
|
||||
else return [];
|
||||
}
|
||||
|
||||
// // this._listenersSubscription.add(dmpSubscription);
|
||||
|
|
Loading…
Reference in New Issue