[ADF-1769] Added prop tables and fixed script (#2896)

* [ADF-1769] Added prop tables and fixed script

* [ADF-1769] Corrected JSDoc formatting errors

* [ADF-1769] Restored default column to prop tables
This commit is contained in:
Andy Stark
2018-01-31 09:22:05 +00:00
committed by Eugenio Romano
parent 8a4959d172
commit 900fd70d63
56 changed files with 601 additions and 519 deletions

View File

@@ -38,8 +38,11 @@ function updatePhase(tree, pathname, aggData) {
});
}
}
return true;
}
else {
return false;
}
return true;
}
exports.updatePhase = updatePhase;
function initialCap(str) {
@@ -87,14 +90,15 @@ function getPropDataFromClassChain(checker, classDec, inputs, outputs) {
// Main class
getPropDataFromClass(checker, classDec, inputs, outputs);
// Inherited classes
for (var _i = 0, _a = classDec.heritageClauses; _i < _a.length; _i++) {
var hc = _a[_i];
var hcType = checker.getTypeFromTypeNode(hc.types[0]);
console.log(checker.getFullyQualifiedName(hcType.symbol));
for (var _b = 0, _c = hcType.symbol.declarations; _b < _c.length; _b++) {
var dec = _c[_b];
if (typescript_1.isClassDeclaration(dec)) {
getPropDataFromClassChain(checker, dec, inputs, outputs);
if (classDec.heritageClauses) {
for (var _i = 0, _a = classDec.heritageClauses; _i < _a.length; _i++) {
var hc = _a[_i];
var hcType = checker.getTypeFromTypeNode(hc.types[0]);
for (var _b = 0, _c = hcType.symbol.declarations; _b < _c.length; _b++) {
var dec = _c[_b];
if (typescript_1.isClassDeclaration(dec)) {
getPropDataFromClassChain(checker, dec, inputs, outputs);
}
}
}
}
@@ -147,7 +151,7 @@ function buildInputsTable(inputs) {
unist.makeTableRow([
unist.makeTableCell([unist.makeText("Name")]),
unist.makeTableCell([unist.makeText("Type")]),
// unist.makeTableCell([unist.makeText("Default value")]),
unist.makeTableCell([unist.makeText("Default value")]),
unist.makeTableCell([unist.makeText("Description")])
])
];
@@ -161,15 +165,23 @@ function buildInputsTable(inputs) {
pDesc = pDesc.replace(/[\n\r]+/, " ");
}
var descCellContent = remark().parse(pDesc).children;
var defaultCellContent;
if (pDefault) {
/*
descCellContent.push(unist.makeHTML("<br/>"));
descCellContent.push(unist.makeText(" Default value: "));
descCellContent.push(unist.makeInlineCode(pDefault));
*/
defaultCellContent = unist.makeInlineCode(pDefault);
}
else {
defaultCellContent = unist.makeText("");
}
var cells = [
unist.makeTableCell([unist.makeText(pName)]),
unist.makeTableCell([unist.makeInlineCode(pType)]),
//unist.makeTableCell([unist.makeText(pDefault)]),
//unist.makeTableCell([unist.makeInlineCode(pDefault)]),
unist.makeTableCell([defaultCellContent]),
unist.makeTableCell(descCellContent)
];
rows.push(unist.makeTableRow(cells));

View File

@@ -47,9 +47,13 @@ export function updatePhase(tree, pathname, aggData) {
});
}
}
return true;
} else {
return false;
}
return true;
}
@@ -122,14 +126,14 @@ function getPropDataFromClassChain(
getPropDataFromClass(checker, classDec, inputs, outputs);
// Inherited classes
for(const hc of classDec.heritageClauses) {
let hcType = checker.getTypeFromTypeNode(hc.types[0]);
console.log(checker.getFullyQualifiedName(hcType.symbol));
for (const dec of hcType.symbol.declarations) {
if (isClassDeclaration(dec)) {
getPropDataFromClassChain(checker, dec, inputs, outputs);
if (classDec.heritageClauses) {
for(const hc of classDec.heritageClauses) {
let hcType = checker.getTypeFromTypeNode(hc.types[0]);
for (const dec of hcType.symbol.declarations) {
if (isClassDeclaration(dec)) {
getPropDataFromClassChain(checker, dec, inputs, outputs);
}
}
}
}
@@ -201,7 +205,7 @@ function buildInputsTable(inputs: any[]) {
unist.makeTableRow([
unist.makeTableCell([unist.makeText("Name")]),
unist.makeTableCell([unist.makeText("Type")]),
// unist.makeTableCell([unist.makeText("Default value")]),
unist.makeTableCell([unist.makeText("Default value")]),
unist.makeTableCell([unist.makeText("Description")])
])
];
@@ -219,16 +223,24 @@ function buildInputsTable(inputs: any[]) {
var descCellContent = remark().parse(pDesc).children;
var defaultCellContent;
if (pDefault) {
/*
descCellContent.push(unist.makeHTML("<br/>"));
descCellContent.push(unist.makeText(" Default value: "));
descCellContent.push(unist.makeInlineCode(pDefault));
*/
defaultCellContent = unist.makeInlineCode(pDefault);
} else {
defaultCellContent = unist.makeText("");
}
var cells = [
unist.makeTableCell([unist.makeText(pName)]),
unist.makeTableCell([unist.makeInlineCode(pType)]),
//unist.makeTableCell([unist.makeText(pDefault)]),
//unist.makeTableCell([unist.makeInlineCode(pDefault)]),
unist.makeTableCell([defaultCellContent]),
unist.makeTableCell(descCellContent)
];