-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: show inherited properties (#9299)
* Fixes that properties from mixins (e.g color, disabled) are not showing up in the docs. * No longer runs Dgeni twice when executing the docs task. Fixes #5284
- Loading branch information
1 parent
acd9066
commit e5a0f7d
Showing
8 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {DocCollection, Processor} from 'dgeni'; | ||
import {ClassExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassExportDoc'; | ||
import {MemberDoc} from 'dgeni-packages/typescript/api-doc-types/MemberDoc'; | ||
|
||
/** | ||
* Processor that merges inherited properties of a class with the class doc. This is necessary | ||
* to properly show public properties from TypeScript mixin interfaces in the API. | ||
*/ | ||
export class MergeInheritedProperties implements Processor { | ||
name = 'merge-inherited-properties'; | ||
$runBefore = ['categorizer']; | ||
|
||
$process(docs: DocCollection) { | ||
return docs | ||
.filter(doc => doc.docType === 'class') | ||
.forEach(doc => this.addInhertiedProperties(doc)); | ||
} | ||
|
||
private addInhertiedProperties(doc: ClassExportDoc) { | ||
doc.implementsClauses.filter(clause => clause.doc).forEach(clause => { | ||
clause.doc!.members.forEach(member => this.addMemberDocIfNotPresent(doc, member)); | ||
}); | ||
|
||
doc.extendsClauses.filter(clause => clause.doc).forEach(clause => { | ||
clause.doc!.members.forEach(member => this.addMemberDocIfNotPresent(doc, member)); | ||
}); | ||
} | ||
|
||
private addMemberDocIfNotPresent(destination: ClassExportDoc, memberDoc: MemberDoc) { | ||
if (!destination.members.find(member => member.name === memberDoc.name)) { | ||
destination.members.push(memberDoc); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters