angular-cn/aio/tools/transforms/templates/api/ngmodule.template.html
2019-01-04 14:06:54 +08:00

84 lines
2.8 KiB
HTML

{% import "lib/memberHelpers.html" as memberHelpers -%}
{% import "lib/descendants.html" as descendants -%}
{% import "lib/paramList.html" as params -%}
{% extends 'export-base.template.html' -%}
{% macro renderTable(items, containerClass, headingText, tableHeading) %}
<section class="{$ containerClass $}">
<h2>{$ headingText $}</h2>
<table class="is-full-width list-table property-table">
<thead>
<tr>
<th>{$ tableHeading $}</th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<td>
<code-example language="ts" hideCopy="true" linenums="false" class="no-box">
{$ item | escape $}
</code-example>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% endmacro %}
{% macro renderExports(items, cssClass, itemType) %}
<section class="{$ cssClass $}s">
<h2>{$ itemType $}</h2>
<table class="is-full-width list-table {$ cssClass $}-table">
<thead>
<tr><th>名称</th><th>说明</th></tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<td>
<a href="{$ item.path $}">
<code-example language="ts" hideCopy="true" linenums="false" class="no-box{% if item.deprecated !== undefined %} deprecated-api-item{% endif %}">{$ item.name | escape $}</code-example>
</a>
</td>
<td>
{% if item.deprecated !== undefined %}{$ ('**已弃用:** ' + item.deprecated) | marked $}{% endif %}
{$ item.shortDescription | marked $}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% endmacro %}
{% block overview %}
{% include "includes/class-overview.html" %}
{% endblock %}
{% block details %}
{% block additional %}{% endblock %}
{% include "includes/description.html" %}
{$ memberHelpers.renderProperties(doc.staticProperties, 'static-properties', 'static-property', '静态属性') $}
{$ memberHelpers.renderMethodDetails(versionInfo, doc.staticMethods, 'static-methods', 'static-method', '静态方法') $}
{% if doc.constructorDoc %}
<h2 id="constructor">构造函数</h2>
{$ memberHelpers.renderMethodDetail(versionInfo, doc.constructorDoc, 'constructor') $}{% endif %}
{$ memberHelpers.renderProperties(doc.properties, 'instance-properties', 'instance-property', '属性') $}
{$ memberHelpers.renderMethodDetails(versionInfo, doc.methods, 'instance-methods', 'instance-method', '方法') $}
{% if doc.ngmoduleOptions.providers %}
{$ renderTable(doc.ngmoduleOptions.providers, 'providers', '提供商', '提供商') $}
{% endif %}
{% if doc.directives.length %}
{$ renderExports(doc.directives, 'directive', '指令') $}
{% endif %}
{% if doc.pipes.length %}
{$ renderExports(doc.pipes, 'pipe', '管道') $}
{% endif %}
{% endblock %}