|
| 1 | +<?js |
| 2 | +const properties = obj; |
| 3 | + |
| 4 | +let hasAttributes = false; |
| 5 | +let hasType = false; |
| 6 | +let hasDefaultValue = false; |
| 7 | +let hasDataValue = false; |
| 8 | + |
| 9 | +for (const property of properties) { |
| 10 | + if (!property) continue; |
| 11 | + |
| 12 | + hasAttributes = hasAttributes |
| 13 | + || property.constant |
| 14 | + || property.optional |
| 15 | + || property.readonly; |
| 16 | + hasDefaultValue = hasDefaultValue || !!property.defaultValue; |
| 17 | + hasDataValue = hasDataValue || !!property.dataValue; |
| 18 | +} |
| 19 | +?> |
| 20 | +<div class="table-wrapper"> |
| 21 | + <table class="member-properties"> |
| 22 | + <caption class="member-properties__caption">Properties:</caption> |
| 23 | + <thead class="member-properties__head"> |
| 24 | + <th class="member-property-header__name">Name</th> |
| 25 | + <th class="member-property-header__type">Type</th> |
| 26 | + <?js if (hasAttributes) {?><th class="member-property-header__name">Attributes</th><?js } ?> |
| 27 | + <?js if (hasDefaultValue) {?><th class="member-property-header__default">Default</th><?js } ?> |
| 28 | + <?js if (hasDataValue) {?><th class="member-property-header__default">Value</th><?js } ?> |
| 29 | + <th class="member-property-header__description">Description</th> |
| 30 | + </thead> |
| 31 | + <tbody class="member-properties__body"> |
| 32 | + <?js properties.forEach((property) => { if (!property) { return; } ?><tr class="member-property"> |
| 33 | + <td class="member-property__name"> |
| 34 | + <?js= property.name ?> |
| 35 | + </td> |
| 36 | + <td class="member-property__type"> |
| 37 | + <?js if (property.dataType) {?><?js= this.linkTo(property.dataType) ?><?js } ?> |
| 38 | + </td> |
| 39 | + <?js if (hasAttributes) {?><td class="member-property__attributes"> |
| 40 | + <?js if (property.optional) { ?><p><optional></p><?js } ?> |
| 41 | + <?js if (property.constant) { ?><p><constant></p><?js } ?> |
| 42 | + <?js if (property.readonly) { ?><p><readonly></p><?js } ?> |
| 43 | + </td><?js } ?> |
| 44 | + <?js if (hasDefaultValue) {?><td class="member-property__default"> |
| 45 | + <?js if (typeof property.defaultValue !== 'undefined') { ?><?js= this.htmlText(property.defaultValue) ?><?js } ?> |
| 46 | + </td><?js } ?> |
| 47 | + <td class="member-property__description"><?js= property.description ?></td> |
| 48 | + </tr><?js }); ?> |
| 49 | + </tbody> |
| 50 | + </table> |
| 51 | +</div> |
0 commit comments