From ce06a75ebf203bfac47f14e6bdd249a988a07fbc Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Thu, 20 Sep 2018 12:57:34 +0100 Subject: [PATCH] build(docs-infra): display inherited members on directives (#25768) PR Close #25768 --- aio/src/styles/2-modules/_api-pages.scss | 3 ++- .../templates/api/directive.template.html | 27 ++++++++++++++++++- .../api/includes/directive-overview.html | 12 --------- .../templates/api/lib/memberHelpers.html | 4 +-- 4 files changed, 30 insertions(+), 16 deletions(-) delete mode 100644 aio/tools/transforms/templates/api/includes/directive-overview.html diff --git a/aio/src/styles/2-modules/_api-pages.scss b/aio/src/styles/2-modules/_api-pages.scss index db7cce98da..1cef682da2 100644 --- a/aio/src/styles/2-modules/_api-pages.scss +++ b/aio/src/styles/2-modules/_api-pages.scss @@ -104,8 +104,9 @@ .ngmodule-list { list-style: none; padding: 0; + } - .selector-list { + .selector-list, .inherited-members-list { ul { padding: 0; li { diff --git a/aio/tools/transforms/templates/api/directive.template.html b/aio/tools/transforms/templates/api/directive.template.html index e84966307a..55bb22ec37 100644 --- a/aio/tools/transforms/templates/api/directive.template.html +++ b/aio/tools/transforms/templates/api/directive.template.html @@ -1,13 +1,37 @@ {% import "lib/memberHelpers.html" as memberHelpers -%} {% extends 'class.template.html' -%} +{% macro renderAncestorMembers(doc, collectionName) %} +{%- for ancestor in doc.extendsClauses %}{% if ancestor.doc %} +{% set nonInternalMembers = ancestor.doc[collectionName] | filterByPropertyValue('internal', undefined) %} +{% if nonInternalMembers.length -%} +
+

Inherited from {$ ancestor.doc.id $}

+ +
+{% endif %} +{$ renderAncestorMembers(ancestor.doc, collectionName) $} +{% endif %}{% endfor -%} +{% endmacro %} + +{% macro renderProperties(doc, heading) %} +{$ memberHelpers.renderProperties(doc.properties, 'instance-properties', 'instance-property', heading) $} +{$ renderAncestorMembers(doc, 'properties') $} +{% endmacro %} + {% block overview %}{% endblock %} {% block details -%} {% include "includes/ngmodule.html" %} {% include "includes/selectors.html" %} - {$ memberHelpers.renderProperties(doc.properties, 'instance-properties', 'instance-property', 'Properties') $} + {$ renderProperties(doc, 'Properties') $} {% include "includes/export-as.html" %} @@ -22,6 +46,7 @@ {$ memberHelpers.renderProperties(doc.staticProperties, 'static-properties', 'static-property', 'Static properties') $} {$ memberHelpers.renderMethodDetails(versionInfo, doc.staticMethods, 'static-methods', 'static-method', 'Static methods') $} {$ memberHelpers.renderMethodDetails(versionInfo, doc.methods, 'instance-methods', 'instance-method', 'Methods') $} + {$ renderAncestorMembers(doc, 'methods') $} {% endblock %} {% block endNotes %}{% endblock %} \ No newline at end of file diff --git a/aio/tools/transforms/templates/api/includes/directive-overview.html b/aio/tools/transforms/templates/api/includes/directive-overview.html deleted file mode 100644 index 0946b1b0a6..0000000000 --- a/aio/tools/transforms/templates/api/includes/directive-overview.html +++ /dev/null @@ -1,12 +0,0 @@ -{% import "lib/memberHelpers.html" as memberHelper -%} - -
-{% for decorator in doc.decorators %} -@{$ decorator.name $}({$ decorator.arguments $}){% endfor %} -class {$ doc.name $}{$ doc.typeParams | escape $}{$ memberHelper.renderHeritage(doc) $} { -{%- if doc.statics.length %}{% for member in doc.statics %}{% if not member.internal %} - {$ memberHelper.renderMemberSyntax(member, 1) $}{% endif %}{% endfor %}{% endif -%} -{$ memberHelper.renderMembers(doc) $} -} - -
diff --git a/aio/tools/transforms/templates/api/lib/memberHelpers.html b/aio/tools/transforms/templates/api/lib/memberHelpers.html index 9628a53161..b984ed69c8 100644 --- a/aio/tools/transforms/templates/api/lib/memberHelpers.html +++ b/aio/tools/transforms/templates/api/lib/memberHelpers.html @@ -168,11 +168,11 @@ {%- endmacro -%} -{%- macro renderProperties(properties, containerClass, propertyClass, headingText, headings) -%} +{%- macro renderProperties(properties, containerClass, propertyClass, headingText, headings, headingLevel = 2) -%} {% set nonInternalProperties = properties | filterByPropertyValue('internal', undefined) %} {% if nonInternalProperties.length -%}
-

{$ headingText $}

+ {$ headingText $}