diff --git a/ionic/components/searchbar/searchbar.ts b/ionic/components/searchbar/searchbar.ts index 7a218addd3..5904229b48 100644 --- a/ionic/components/searchbar/searchbar.ts +++ b/ionic/components/searchbar/searchbar.ts @@ -42,19 +42,6 @@ export class SearchbarInput { * * ``` * - * @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/ * @see {@link /docs/v2/components#searchbar Searchbar Component Docs} */ @@ -79,40 +66,47 @@ export class Searchbar extends Ion { @ViewChild(SearchbarInput) searchbarInput; /** - * @private + * @input {string} Sets the cancel button text to the value passed in */ @Input() cancelButtonText: string; + /** - * @private + * @input {boolean} Hides the cancel button */ @Input() hideCancelButton: any; + /** - * @private + * @input {string} Sets input placeholder to the value passed in */ @Input() placeholder: string; + /** - * @private + * @input {Any} Expression to evaluate when the Searchbar input has changed including cleared */ @Input() ngModel: any; /** - * @private + * @output {event} When the Searchbar input has changed including cleared */ @Output() input: EventEmitter = new EventEmitter(); + /** - * @private + * @output {event} When the Searchbar input has blurred */ @Output() blur: EventEmitter = new EventEmitter(); + /** - * @private + * @output {event} When the Searchbar input has focused */ @Output() focus: EventEmitter = new EventEmitter(); + /** - * @private + * @output {event} When the cancel button is clicked */ @Output() cancel: EventEmitter = new EventEmitter(); + /** - * @private + * @output {event} When the clear input button is clicked */ @Output() clear: EventEmitter = new EventEmitter(); diff --git a/scripts/docs/dgeni-config.js b/scripts/docs/dgeni-config.js index 59519b99dc..dab42849e4 100644 --- a/scripts/docs/dgeni-config.js +++ b/scripts/docs/dgeni-config.js @@ -20,6 +20,7 @@ module.exports = function(currentVersion){ .processor(require('./processors/jekyll')) .processor(require('./processors/remove-private-members')) .processor(require('./processors/hide-private-api')) +.processor(require('./processors/collect-inputs-outputs')) // for debugging docs @@ -29,7 +30,8 @@ module.exports = function(currentVersion){ // $runBefore: ['rendering-docs'], // $process: function(docs){ // docs.forEach(function(doc){ -// if (doc.members && doc.name == "IonicApp"){ +// if (doc.name == "Searchbar"){ +// console.log(doc.input); // doc.members.forEach(function(method){ // if (method.name === "load") { // console.log(method); @@ -173,4 +175,3 @@ module.exports = function(currentVersion){ }) } - diff --git a/scripts/docs/processors/collect-inputs-outputs.js b/scripts/docs/processors/collect-inputs-outputs.js new file mode 100644 index 0000000000..b8b2af97ac --- /dev/null +++ b/scripts/docs/processors/collect-inputs-outputs.js @@ -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; + } + }); + } + }; +}; diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index a0d049f313..dea028ad4c 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -57,6 +57,26 @@ angular_controller: APIDemoCtrl <@ endif @> <@- endmacro -@> +<@ macro inputTable(params, isDirective) -@> + + + + Attr + Type + Details + + + + <@ for param in params @> + + <$ param.name $> + <$ param.type $> + <$ param.description | marked $> + + <@ endfor @> + + +<@- endmacro -@> <@- macro functionSyntax(fn) @> <@- set sep = joiner(', ') -@> @@ -244,6 +264,20 @@ Improve this doc <@- endif -@> + +<@- if doc.inputs and doc.inputs.length @> + +Element Input Attributes +<$ inputTable(doc.inputs) $> +<@- endif -@> + +<@- if doc.inputs and doc.inputs.length @> + +Element Output Attributes +<$ inputTable(doc.outputs) $> +<@- endif -@> + + <@- if doc.see @>
<$ param.type $>