diff --git a/src/lib/output/themes/DefaultTheme.ts b/src/lib/output/themes/DefaultTheme.ts index f252d5d27..15a4c662e 100644 --- a/src/lib/output/themes/DefaultTheme.ts +++ b/src/lib/output/themes/DefaultTheme.ts @@ -392,43 +392,24 @@ export class NavigationBuilder { if (modules.length < 10) { this.buildGroups(modules, root); } else { - this.buildGroups(this.entryPoint.getChildrenByKind(ReflectionKind.SomeModule), root, this.buildChildren); + this.buildGroups(this.entryPoint.getChildrenByKind(ReflectionKind.SomeModule), root, true); } return root; } - /** - * Create navigation nodes for all container children of the given reflection. - * - * @param reflection The reflection whose children modules should be transformed into navigation nodes. - * @param parent The parent NavigationItem of the newly created nodes. - */ - protected buildChildren(reflection: DeclarationReflection, parent: NavigationItem) { - const modules = reflection.getChildrenByKind(ReflectionKind.SomeModule); - modules.sort((a: DeclarationReflection, b: DeclarationReflection) => { - return a.getFullName() < b.getFullName() ? -1 : 1; - }); - - modules.forEach((reflection) => { - const item = NavigationItem.create(reflection, parent); - this.includeDedicatedUrls(reflection, item); - this.buildChildren(reflection, item); - }); - } - /** * Create navigation nodes for the given list of reflections. The resulting nodes will be grouped into * an "internal" and an "external" section when applicable. * * @param reflections The list of reflections which should be transformed into navigation nodes. * @param parent The parent NavigationItem of the newly created nodes. - * @param callback Optional callback invoked for each generated node. + * @param buildChildren Whether navigation nodes should also be built for the children of each reflection. */ protected buildGroups( reflections: DeclarationReflection[], parent: NavigationItem, - callback?: (reflection: DeclarationReflection, item: NavigationItem) => void + buildChildren: boolean = false ) { let state = -1; const hasExternals = this.containsExternals(reflections); @@ -445,12 +426,31 @@ export class NavigationBuilder { const item = NavigationItem.create(reflection, parent); this.includeDedicatedUrls(reflection, item); - if (callback) { - callback(reflection, item); + if (buildChildren) { + this.buildChildren(reflection, item); } }); } + /** + * Create navigation nodes for all container children of the given reflection. + * + * @param reflection The reflection whose children modules should be transformed into navigation nodes. + * @param parent The parent NavigationItem of the newly created nodes. + */ + protected buildChildren(reflection: DeclarationReflection, parent: NavigationItem) { + const modules = reflection.getChildrenByKind(ReflectionKind.SomeModule); + modules.sort((a: DeclarationReflection, b: DeclarationReflection) => { + return a.getFullName() < b.getFullName() ? -1 : 1; + }); + + modules.forEach((reflection) => { + const item = NavigationItem.create(reflection, parent); + this.includeDedicatedUrls(reflection, item); + this.buildChildren(reflection, item); + }); + } + /** * Test whether the given list of modules contains an external module. *