| 1 |
<?js |
| 2 |
var data = obj; |
| 3 |
var props = data.subprops || data.properties; |
| 4 |
|
| 5 |
/* sort subprops under their parent props (like opts.classname) */ |
| 6 |
var parentProp = null; |
| 7 |
props.forEach(function(prop, i) { |
| 8 |
if (!prop) { return; } |
| 9 |
if ( parentProp && prop.name && prop.name.indexOf(parentProp.name + '.') === 0 ) { |
| 10 |
prop.name = prop.name.substr(parentProp.name.length+1); |
| 11 |
parentProp.subprops = parentProp.subprops || []; |
| 12 |
parentProp.subprops.push(prop); |
| 13 |
props[i] = null; |
| 14 |
} |
| 15 |
else { |
| 16 |
parentProp = prop; |
| 17 |
} |
| 18 |
}); |
| 19 |
?> |
| 20 |
|
| 21 |
<table class="props"> |
| 22 |
<thead> |
| 23 |
<tr> |
| 24 |
<th>Name</th> |
| 25 |
<th>Type</th> |
| 26 |
<th class="last">Description</th> |
| 27 |
</tr> |
| 28 |
</thead> |
| 29 |
|
| 30 |
<tbody> |
| 31 |
<?js |
| 32 |
var self = this; |
| 33 |
const displayProp = (prop,indent=0) => { |
| 34 |
if (!prop) { return; } |
| 35 |
?> |
| 36 |
|
| 37 |
<tr> |
| 38 |
<td class="name"> |
| 39 |
<code> |
| 40 |
<?js for( var k = 0; k < indent; k++) { ?> |
| 41 |
|
| 42 |
<?js } ?> |
| 43 |
<?js= (indent ? '.' : '') + prop.name ?> |
| 44 |
</code> |
| 45 |
</td> |
| 46 |
<td class="type"> |
| 47 |
<?js if (prop.type && prop.type.names) {?> |
| 48 |
<?js= self.partial('type.tmpl', prop.type.names) ?> |
| 49 |
<?js if (prop.optional) { ?> |
| 50 |
(opt.) |
| 51 |
<?js } ?> |
| 52 |
<?js } ?> |
| 53 |
</td> |
| 54 |
<td class="description last"> |
| 55 |
<?js= prop.description ?> |
| 56 |
</td> |
| 57 |
</tr> |
| 58 |
<?js if (prop.subprops) prop.subprops.forEach((p) => displayProp(p,indent+1)); ?> |
| 59 |
|
| 60 |
<?js |
| 61 |
}; |
| 62 |
props.forEach( (p) => displayProp(p) ); |
| 63 |
?> |
| 64 |
<?js if (data.augments && data.augments.length) data.augments.forEach((a) => { |
| 65 |
const href = /^\[(.+)\]\((.+)\) */; |
| 66 |
const m = href.exec(a); |
| 67 |
if (m) { ?> |
| 68 |
<tr> |
| 69 |
<td><tt>...</tt></td> |
| 70 |
<td><a href="<?js= m[2] ?>"><?js= m[1] ?></a></td> |
| 71 |
<td>Super Class Properties</td> |
| 72 |
</tr> |
| 73 |
<?js }})?> |
| 74 |
</tbody> |
| 75 |
</table> |