Skip to content

Commit

Permalink
feat(docs): @docs-private support (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
yggg authored and nnixaa committed Feb 18, 2019
1 parent 9a5f4d9 commit dc33127
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 19 deletions.
1 change: 1 addition & 0 deletions docs/app/@theme/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export * from './visibility.service';
export * from './pagination.service';
export * from './analytics.service';
export * from './menu.service';
export * from './metadata.service';
8 changes: 8 additions & 0 deletions docs/app/@theme/services/metadata.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Injectable } from '@angular/core';

@Injectable()
export class NgdMetadataService {
isPublic(prop): boolean {
return !prop.isDocsPrivate && !prop.inherited;
}
}
9 changes: 7 additions & 2 deletions docs/app/@theme/services/tabbed.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { Injectable } from '@angular/core';
import { NgdMetadataService } from './metadata.service';

@Injectable()
export class NgdTabbedService {

constructor(private metadataService: NgdMetadataService) {}

determineTabs(tabs: any): { [tab: string]: boolean } {
return {
'overview': this.hasOverview(tabs),
Expand Down Expand Up @@ -36,14 +39,16 @@ export class NgdTabbedService {
componentHasProps(component): boolean {
return component &&
component.props &&
component.props.length > 0;
component.props.filter(m => this.metadataService.isPublic(m)).length > 0;
}

componentHasMethods(component): boolean {
return component &&
component.methods &&
component.methods.length > 0 &&
component.methods.some(method => method.shortDescription || method.description);
component.methods
.filter(m => this.metadataService.isPublic(m))
.some(method => method.shortDescription || method.description);
}

componentHasOverview(component): boolean {
Expand Down
2 changes: 2 additions & 0 deletions docs/app/@theme/theme.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
NgdPaginationService,
NgdAnalytics,
NgdMenuService,
NgdMetadataService,
} from './services';


Expand Down Expand Up @@ -111,6 +112,7 @@ export class NgdThemeModule {
NgdAnalytics,
NgdMenuService,
NgdVisibilityService,
NgdMetadataService,
],
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { NgdMetadataService } from '../../../@theme/services';

@Component({
selector: 'ngd-methods-block',
Expand Down Expand Up @@ -49,6 +50,8 @@ export class NgdMethodsBlockComponent {

@Input('source')
set setSource(source: any) {
this.methods = source.methods;
this.methods = source.methods.filter(m => this.metadataService.isPublic(m));
};

constructor(private metadataService: NgdMetadataService) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { NgdMetadataService } from '../../../@theme/services';

@Component({
selector: 'ngd-props-block',
Expand Down Expand Up @@ -42,10 +43,12 @@ export class NgdPropsBlockComponent {

@Input('source')
set setSource(source: any) {
this.inputs = source.props.filter(item => item.kind === 'input');
this.outputs = source.props.filter(item => item.kind === 'output');
this.props = source.props.filter(item => item.kind === 'property');
this.inputs = source.props.filter(item => item.kind === 'input').filter(m => this.metadataService.isPublic(m));
this.outputs = source.props.filter(item => item.kind === 'output').filter(m => this.metadataService.isPublic(m));
this.props = source.props.filter(item => item.kind === 'property').filter(m => this.metadataService.isPublic(m));
this.name = source.name;
this.slag = source.slag;
}

constructor(private metadataService: NgdMetadataService) {}
}
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"codelyzer": "4.5.0",
"conventional-changelog-cli": "1.3.4",
"del": "3.0.0",
"doc-prsr": "2.1.1",
"doc-prsr": "2.2.0",
"firebase-tools": "^3.18.6",
"gulp": "3.9.1",
"gulp-autoprefixer": "3.1.1",
Expand Down Expand Up @@ -174,4 +174,4 @@
"uglifyjs-webpack-plugin": "1.1.5"
},
"schematics": "./schematics/dist/collection.json"
}
}

0 comments on commit dc33127

Please sign in to comment.