Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/lib/output/themes/default/DefaultTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,11 @@ export class DefaultTheme extends Theme {
}

if (parent.categories && shouldShowCategories(parent, opts)) {
return filterMap(parent.categories, toNavigation);
return filterMapWithNoneCollection(parent.categories);
}

if (parent.groups && shouldShowGroups(parent, opts)) {
return filterMap(parent.groups, toNavigation);
return filterMapWithNoneCollection(parent.groups);
}

if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
Expand All @@ -397,6 +397,20 @@ export class DefaultTheme extends Theme {
return filterMap(parent.childrenIncludingDocuments, toNavigation);
}

function filterMapWithNoneCollection(reflection: ReflectionGroup[] | ReflectionCategory[]) {
const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");

const mappedOthers = filterMap(others, toNavigation);

if (none) {
const noneMappedChildren = filterMap(none.children, toNavigation);
return [...noneMappedChildren, ...mappedOthers];
}

return mappedOthers;
}

function deriveModuleFolders(children: Array<DeclarationReflection | DocumentReflection>) {
const result: NavigationElement[] = [];

Expand Down