Skip to content

fix(datepicker): generate api docs #4756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2017
Merged
Show file tree
Hide file tree
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
7 changes: 2 additions & 5 deletions src/lib/datepicker/datepicker-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {MdDatepickerIntl} from './datepicker-intl';
template: '',
styleUrls: ['datepicker-toggle.css'],
host: {
'[attr.type]': 'type',
'[class.mat-datepicker-toggle]': 'true',
'type': 'button',
'class': 'mat-datepicker-toggle',
'[attr.aria-label]': '_intl.openCalendarLabel',
'(click)': '_open($event)',
},
Expand All @@ -21,9 +21,6 @@ export class MdDatepickerToggle<D> {
/** Datepicker instance that the button will toggle. */
@Input('mdDatepickerToggle') datepicker: MdDatepicker<D>;

/** Type of the button. */
@Input() type: string = 'button';

@Input('matDatepickerToggle')
get _datepicker() { return this.datepicker; }
set _datepicker(v: MdDatepicker<D>) { this.datepicker = v; }
Expand Down
2 changes: 1 addition & 1 deletion src/lib/datepicker/datepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let datepickerUid = 0;
* MdCalendar directly as the content so we can control the initial focus. This also gives us a
* place to put additional features of the popup that are not part of the calendar itself in the
* future. (e.g. confirmation buttons).
* @docs-internal
* @docs-private
*/
@Component({
moduleId: module.id,
Expand Down
3 changes: 2 additions & 1 deletion tools/dgeni/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ let apiDocsPackage = new DgeniPackage('material2-api-docs', dgeniPackageDeps)
'checkbox/index.ts',
'chips/index.ts',
'core/index.ts',
'datepicker/index.ts',
'dialog/index.ts',
'grid-list/index.ts',
'icon/index.ts',
Expand Down Expand Up @@ -143,4 +144,4 @@ let apiDocsPackage = new DgeniPackage('material2-api-docs', dgeniPackageDeps)
});


module.exports = apiDocsPackage;
module.exports = apiDocsPackage;
20 changes: 16 additions & 4 deletions tools/dgeni/processors/categorizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ module.exports = function categorizer() {
}
};

/** Function that walks through all inherited docs and collects public methods. */
/** Walks through all inherited docs and collects public methods. */
function resolveMethods(classDoc) {
let methods = classDoc.members.filter(member => member.hasOwnProperty('parameters'));
let methods = classDoc.members.filter(isMethod);

if (classDoc.inheritedDoc) {
methods = methods.concat(resolveMethods(classDoc.inheritedDoc));
Expand All @@ -101,9 +101,9 @@ function resolveMethods(classDoc) {
return methods;
}

/** Function that walks through all inherited docs and collects public properties. */
/** Walks through all inherited docs and collects public properties. */
function resolveProperties(classDoc) {
let properties = classDoc.members.filter(member => !member.hasOwnProperty('parameters'));
let properties = classDoc.members.filter(isProperty);

if (classDoc.inheritedDoc) {
properties = properties.concat(resolveProperties(classDoc.inheritedDoc));
Expand Down Expand Up @@ -153,6 +153,18 @@ function normalizeMethodParameters(method) {
}
}

function isMethod(doc) {
return doc.hasOwnProperty('parameters');
}

function isGenericTypeParameter(doc) {
return doc.classDoc.typeParams && `<${doc.name}>` === doc.classDoc.typeParams;
}

function isProperty(doc) {
return doc.docType === 'member' && !isMethod(doc) && !isGenericTypeParameter(doc);
}

function isDirective(doc) {
return hasClassDecorator(doc, 'Component') || hasClassDecorator(doc, 'Directive');
}
Expand Down