mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
chore(dgeni): setting inputs and outputs detection in dgeni
This commit is contained in:
@ -42,19 +42,6 @@ export class SearchbarInput {
|
|||||||
* <ion-searchbar [(ngModel)]="defaultSearch" (input)="triggerInput($event)" (cancel)="onCancelSearchbar($event)" (clear)="onClearSearchbar($event)"></ion-searchbar>
|
* <ion-searchbar [(ngModel)]="defaultSearch" (input)="triggerInput($event)" (cancel)="onCancelSearchbar($event)" (clear)="onClearSearchbar($event)"></ion-searchbar>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @property {string} [cancelButtonText=Cancel] - Sets the cancel button text to the value passed in
|
|
||||||
* @property {boolean} [hideCancelButton=false] - Hides the cancel button
|
|
||||||
* @property {string} [placeholder=Search] - Sets input placeholder to the value passed in
|
|
||||||
*
|
|
||||||
* @property {Any} [input] - Expression to evaluate when the Searchbar input has changed including cleared
|
|
||||||
* @property {Any} [keydown] - Expression to evaluate when a key is pushed down in the Searchbar input
|
|
||||||
* @property {Any} [keypress] - Expression to evaluate when a character is inserted in the Searchbar input
|
|
||||||
* @property {Any} [keyup] - Expression to evaluate when a key is released in the Searchbar input
|
|
||||||
* @property {Any} [blur] - Expression to evaluate when the Searchbar input has blurred
|
|
||||||
* @property {Any} [focus] - Expression to evaluate when the Searchbar input has focused
|
|
||||||
* @property {Any} [cancel] - Expression to evaluate when the cancel button is clicked
|
|
||||||
* @property {Any} [clear] - Expression to evaluate when the clear input button is clicked
|
|
||||||
*
|
|
||||||
* @demo /docs/v2/demos/searchbar/
|
* @demo /docs/v2/demos/searchbar/
|
||||||
* @see {@link /docs/v2/components#searchbar Searchbar Component Docs}
|
* @see {@link /docs/v2/components#searchbar Searchbar Component Docs}
|
||||||
*/
|
*/
|
||||||
@ -79,40 +66,47 @@ export class Searchbar extends Ion {
|
|||||||
@ViewChild(SearchbarInput) searchbarInput;
|
@ViewChild(SearchbarInput) searchbarInput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @input {string} Sets the cancel button text to the value passed in
|
||||||
*/
|
*/
|
||||||
@Input() cancelButtonText: string;
|
@Input() cancelButtonText: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @input {boolean} Hides the cancel button
|
||||||
*/
|
*/
|
||||||
@Input() hideCancelButton: any;
|
@Input() hideCancelButton: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @input {string} Sets input placeholder to the value passed in
|
||||||
*/
|
*/
|
||||||
@Input() placeholder: string;
|
@Input() placeholder: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @input {Any} Expression to evaluate when the Searchbar input has changed including cleared
|
||||||
*/
|
*/
|
||||||
@Input() ngModel: any;
|
@Input() ngModel: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @output {event} When the Searchbar input has changed including cleared
|
||||||
*/
|
*/
|
||||||
@Output() input: EventEmitter<Searchbar> = new EventEmitter();
|
@Output() input: EventEmitter<Searchbar> = new EventEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @output {event} When the Searchbar input has blurred
|
||||||
*/
|
*/
|
||||||
@Output() blur: EventEmitter<Searchbar> = new EventEmitter();
|
@Output() blur: EventEmitter<Searchbar> = new EventEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @output {event} When the Searchbar input has focused
|
||||||
*/
|
*/
|
||||||
@Output() focus: EventEmitter<Searchbar> = new EventEmitter();
|
@Output() focus: EventEmitter<Searchbar> = new EventEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @output {event} When the cancel button is clicked
|
||||||
*/
|
*/
|
||||||
@Output() cancel: EventEmitter<Searchbar> = new EventEmitter();
|
@Output() cancel: EventEmitter<Searchbar> = new EventEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @output {event} When the clear input button is clicked
|
||||||
*/
|
*/
|
||||||
@Output() clear: EventEmitter<Searchbar> = new EventEmitter();
|
@Output() clear: EventEmitter<Searchbar> = new EventEmitter();
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ module.exports = function(currentVersion){
|
|||||||
.processor(require('./processors/jekyll'))
|
.processor(require('./processors/jekyll'))
|
||||||
.processor(require('./processors/remove-private-members'))
|
.processor(require('./processors/remove-private-members'))
|
||||||
.processor(require('./processors/hide-private-api'))
|
.processor(require('./processors/hide-private-api'))
|
||||||
|
.processor(require('./processors/collect-inputs-outputs'))
|
||||||
|
|
||||||
|
|
||||||
// for debugging docs
|
// for debugging docs
|
||||||
@ -29,7 +30,8 @@ module.exports = function(currentVersion){
|
|||||||
// $runBefore: ['rendering-docs'],
|
// $runBefore: ['rendering-docs'],
|
||||||
// $process: function(docs){
|
// $process: function(docs){
|
||||||
// docs.forEach(function(doc){
|
// docs.forEach(function(doc){
|
||||||
// if (doc.members && doc.name == "IonicApp"){
|
// if (doc.name == "Searchbar"){
|
||||||
|
// console.log(doc.input);
|
||||||
// doc.members.forEach(function(method){
|
// doc.members.forEach(function(method){
|
||||||
// if (method.name === "load") {
|
// if (method.name === "load") {
|
||||||
// console.log(method);
|
// console.log(method);
|
||||||
@ -173,4 +175,3 @@ module.exports = function(currentVersion){
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
62
scripts/docs/processors/collect-inputs-outputs.js
Normal file
62
scripts/docs/processors/collect-inputs-outputs.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
module.exports = function collectInputsOutputs() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
$runBefore: ['rendering-docs'],
|
||||||
|
$process: function(docs) {
|
||||||
|
docs.forEach(function(doc) {
|
||||||
|
// if (doc.members && doc.name == "Searchbar"){
|
||||||
|
// console.log(doc.exportSymbol.members.hideCancelButton.valueDeclaration.decorators[0].expression.expression);
|
||||||
|
// doc.members.forEach(function(method){
|
||||||
|
// if (method.name === "load") {
|
||||||
|
// console.log(method);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (doc.members && doc.members.length) {
|
||||||
|
var members = [];
|
||||||
|
var inputs = [];
|
||||||
|
var outputs = [];
|
||||||
|
|
||||||
|
memberLoop:
|
||||||
|
for (var i in doc.members) {
|
||||||
|
if (doc.members[i].decorators && doc.members[i].decorators.length) {
|
||||||
|
|
||||||
|
decoratorLoop:
|
||||||
|
for (var ii in doc.members[i].decorators) {
|
||||||
|
|
||||||
|
if (doc.members[i].decorators[ii].name == 'Input') {
|
||||||
|
inputs.push(parseMember(doc.members[i]));
|
||||||
|
continue memberLoop;
|
||||||
|
}
|
||||||
|
if (doc.members[i].decorators[ii].name == 'Output') {
|
||||||
|
outputs.push(parseMember(doc.members[i]));
|
||||||
|
continue memberLoop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not an input or output, must be a plain member
|
||||||
|
members.push(doc.members[i]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// update doc with pruned members list and add inputs and outputs
|
||||||
|
doc.members = members;
|
||||||
|
doc.inputs = inputs;
|
||||||
|
doc.outputs = outputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseMember(member) {
|
||||||
|
member.type = member.content.substring(
|
||||||
|
member.content.indexOf('{') + 1,
|
||||||
|
member.content.indexOf('}')
|
||||||
|
);
|
||||||
|
member.description = member.content.substring(
|
||||||
|
member.content.indexOf('}') + 1,
|
||||||
|
member.content.length
|
||||||
|
);
|
||||||
|
return member;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
34
scripts/docs/templates/common.template.html
vendored
34
scripts/docs/templates/common.template.html
vendored
@ -57,6 +57,26 @@ angular_controller: APIDemoCtrl <@ endif @>
|
|||||||
</table>
|
</table>
|
||||||
<@- endmacro -@>
|
<@- endmacro -@>
|
||||||
|
|
||||||
|
<@ macro inputTable(params, isDirective) -@>
|
||||||
|
<table class="table param-table" style="margin:0;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Attr</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Details</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<@ for param in params @>
|
||||||
|
<tr>
|
||||||
|
<td><$ param.name $></td>
|
||||||
|
<td><code><$ param.type $></code></td>
|
||||||
|
<td><$ param.description | marked $></td>
|
||||||
|
</tr>
|
||||||
|
<@ endfor @>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<@- endmacro -@>
|
||||||
|
|
||||||
<@- macro functionSyntax(fn) @>
|
<@- macro functionSyntax(fn) @>
|
||||||
<@- set sep = joiner(', ') -@>
|
<@- set sep = joiner(', ') -@>
|
||||||
@ -244,6 +264,20 @@ Improve this doc
|
|||||||
|
|
||||||
<@- endif -@>
|
<@- endif -@>
|
||||||
|
|
||||||
|
|
||||||
|
<@- if doc.inputs and doc.inputs.length @>
|
||||||
|
<!-- input methods on the class -->
|
||||||
|
<h2>Element Input Attributes</h2>
|
||||||
|
<$ inputTable(doc.inputs) $>
|
||||||
|
<@- endif -@>
|
||||||
|
|
||||||
|
<@- if doc.inputs and doc.inputs.length @>
|
||||||
|
<!-- output events on the class -->
|
||||||
|
<h2>Element Output Attributes</h2>
|
||||||
|
<$ inputTable(doc.outputs) $>
|
||||||
|
<@- endif -@>
|
||||||
|
|
||||||
|
|
||||||
<!-- related link -->
|
<!-- related link -->
|
||||||
<@- if doc.see @>
|
<@- if doc.see @>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user