From 637ef836cca5d2be81f58c55679be2829b7c7686 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 28 Jun 2018 23:13:01 +0200 Subject: [PATCH] feat(docs): show additional type aliases in docs. (#11901) --- src/lib/input/autosize.ts | 3 ++- tools/dgeni/processors/component-grouper.ts | 12 +++++++++--- .../dgeni/templates/componentGroup.template.html | 14 ++++++++++++++ tools/dgeni/templates/type-alias.template.html | 15 +++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 tools/dgeni/templates/type-alias.template.html diff --git a/src/lib/input/autosize.ts b/src/lib/input/autosize.ts index fd4f50c6f9c..3ee75b91a08 100644 --- a/src/lib/input/autosize.ts +++ b/src/lib/input/autosize.ts @@ -12,7 +12,8 @@ import {Directive, Input} from '@angular/core'; /** * Directive to automatically resize a textarea to fit its content. - * @deletion-target 7.0.0 deprecate in favor of `cdkTextareaAutosize`. + * @deprecated Use `cdkTextareaAutosize` from `@angular/cdk/text-field` instead. + * @deletion-target 7.0.0 */ @Directive({ selector: 'textarea[mat-autosize], textarea[matTextareaAutosize]', diff --git a/tools/dgeni/processors/component-grouper.ts b/tools/dgeni/processors/component-grouper.ts index 2b33c77f627..f80799e1d4f 100644 --- a/tools/dgeni/processors/component-grouper.ts +++ b/tools/dgeni/processors/component-grouper.ts @@ -1,7 +1,8 @@ import {DocCollection, Document, Processor} from 'dgeni'; import {InterfaceExportDoc} from 'dgeni-packages/typescript/api-doc-types/InterfaceExportDoc'; -import * as path from 'path'; +import {TypeAliasExportDoc} from 'dgeni-packages/typescript/api-doc-types/TypeAliasExportDoc'; import {CategorizedClassDoc} from '../common/dgeni-definitions'; +import * as path from 'path'; /** Component group data structure. */ export class ComponentGroup { @@ -42,6 +43,9 @@ export class ComponentGroup { /** Additional interfaces that belong to the component group. */ additionalInterfaces: InterfaceExportDoc[] = []; + /** Additional type aliases that belong to the component group. */ + additionalTypeAliases: TypeAliasExportDoc[] = []; + /** NgModule that defines the current component group. */ ngModule: CategorizedClassDoc | null = null; @@ -93,10 +97,12 @@ export class ComponentGrouper implements Processor { group.services.push(doc); } else if (doc.isNgModule) { group.ngModule = doc; - } else if (doc.docType == 'class') { + } else if (doc.docType === 'class') { group.additionalClasses.push(doc); - } else if (doc.docType == 'interface') { + } else if (doc.docType === 'interface') { group.additionalInterfaces.push(doc); + } else if (doc.docType === 'type-alias') { + group.additionalTypeAliases.push(doc); } }); diff --git a/tools/dgeni/templates/componentGroup.template.html b/tools/dgeni/templates/componentGroup.template.html index 3e218eb38bf..3dc381419d2 100644 --- a/tools/dgeni/templates/componentGroup.template.html +++ b/tools/dgeni/templates/componentGroup.template.html @@ -23,6 +23,10 @@ {% include 'interface.template.html' %} {% endmacro %} +{% macro typeAlias(alias) -%} + {% include 'type-alias.template.html' %} +{% endmacro %} +

API reference for Angular {$ doc.packageDisplayName $} {$ doc.displayName $} @@ -74,4 +78,14 @@ {$ interface(item) $} {% endfor %} {%- endif -%} + + {%- if doc.additionalTypeAliases.length -%} +

+ {% for item in doc.additionalTypeAliases %} + {$ typeAlias(item) $} + {% endfor %} + {%- endif -%}
diff --git a/tools/dgeni/templates/type-alias.template.html b/tools/dgeni/templates/type-alias.template.html new file mode 100644 index 00000000000..0a83a682acf --- /dev/null +++ b/tools/dgeni/templates/type-alias.template.html @@ -0,0 +1,15 @@ +{% import "macros.html" as macros %} + + + +{%- if alias.description -%} +

{$ alias.description | marked | safe $}

+{%- endif -%} + +

+ Type: + {$ alias.typeDefinition $} +