|
9 | 9 | </div> |
10 | 10 | </cps-tab> |
11 | 11 | <cps-tab label="API"> |
12 | | - <ng-container *ngIf="componentData"> |
13 | | - <ng-container |
14 | | - *ngIf=" |
15 | | - componentData.components && |
16 | | - (componentData.components | objectEntries).length > 0 |
17 | | - "> |
18 | | - <div *ngFor="let data of componentData.components | objectEntries"> |
19 | | - <h1>{{ data[0] }}</h1> |
20 | | - <p>{{ data[1].description }}</p> |
21 | | - <!-- Input Props --> |
| 12 | + @if (componentData) { |
| 13 | + @if ( |
| 14 | + componentData.components && |
| 15 | + (componentData.components | objectEntries).length > 0 |
| 16 | + ) { |
| 17 | + @for (data of componentData.components | objectEntries; track data) { |
22 | 18 | <div> |
23 | | - <h2>Properties</h2> |
24 | | - <p>{{ data[1].props.description }}</p> |
| 19 | + <h1>{{ data[0] }}</h1> |
| 20 | + <p>{{ data[1].description }}</p> |
| 21 | + <!-- Input Props --> |
25 | 22 | <div> |
26 | | - <table class="data-table"> |
27 | | - <thead> |
28 | | - <th>Name</th> |
29 | | - <th>Type</th> |
30 | | - <th>Default value</th> |
31 | | - <th>Description</th> |
32 | | - </thead> |
33 | | - <tbody> |
34 | | - <tr *ngFor="let prop of data[1].props.values"> |
35 | | - <td class="highlighted-bg"> |
36 | | - <span>{{ prop.name }}</span> |
37 | | - </td> |
38 | | - <td class="highlighted-text"> |
39 | | - <a |
40 | | - *ngIf=" |
41 | | - prop.type | detectType: TypesMap as type; |
42 | | - else simpleType1 |
43 | | - " |
44 | | - [routerLink]="'/' + TypesMap[type] + '/api'" |
45 | | - fragment="{{ type }}" |
46 | | - >{{ prop.type }}</a |
47 | | - > |
48 | | - <ng-template #simpleType1> |
49 | | - <span>{{ prop.type }}</span> |
50 | | - </ng-template> |
51 | | - </td> |
52 | | - <td class="value-style"> |
53 | | - <span>{{ |
54 | | - (prop.default === '' ? "''" : prop.default) ?? |
55 | | - 'undefined' |
56 | | - }}</span> |
57 | | - </td> |
58 | | - <td>{{ prop.description }}</td> |
59 | | - </tr> |
60 | | - </tbody> |
61 | | - </table> |
62 | | - </div> |
63 | | - <!-- Emits --> |
64 | | - <div *ngIf="data[1].emits"> |
65 | | - <h2>Events</h2> |
66 | | - <p>{{ data[1].emits.description }}</p> |
| 23 | + <h2>Properties</h2> |
| 24 | + <p>{{ data[1].props.description }}</p> |
67 | 25 | <div> |
68 | 26 | <table class="data-table"> |
69 | 27 | <thead> |
70 | 28 | <th>Name</th> |
71 | | - <th>Parameters</th> |
| 29 | + <th>Type</th> |
| 30 | + <th>Default value</th> |
72 | 31 | <th>Description</th> |
73 | 32 | </thead> |
74 | 33 | <tbody> |
75 | | - <tr *ngFor="let event of data[1].emits.values"> |
76 | | - <td class="highlighted-bg"> |
77 | | - <span>{{ event.name }}</span> |
78 | | - </td> |
79 | | - <td class="highlighted-text"> |
80 | | - <a |
81 | | - *ngIf=" |
82 | | - event.parameters[0].type |
83 | | - | detectType: TypesMap as type; |
84 | | - else simpleType2 |
85 | | - " |
86 | | - [routerLink]="'/' + TypesMap[type] + '/api'" |
87 | | - fragment="{{ type }}" |
88 | | - >{{ event.parameters[0].type }}</a |
89 | | - > |
90 | | - <ng-template #simpleType2> |
91 | | - <span>{{ event.parameters[0].type }}</span> |
92 | | - </ng-template> |
93 | | - </td> |
94 | | - <td>{{ event.description }}</td> |
95 | | - </tr> |
| 34 | + @for (prop of data[1].props.values; track prop) { |
| 35 | + <tr> |
| 36 | + <td class="highlighted-bg"> |
| 37 | + <span>{{ prop.name }}</span> |
| 38 | + </td> |
| 39 | + <td class="highlighted-text"> |
| 40 | + @if (prop.type | detectType: TypesMap; as type) { |
| 41 | + <a |
| 42 | + [routerLink]="'/' + TypesMap[type] + '/api'" |
| 43 | + fragment="{{ type }}" |
| 44 | + >{{ prop.type }}</a |
| 45 | + > |
| 46 | + } @else { |
| 47 | + <span>{{ prop.type }}</span> |
| 48 | + } |
| 49 | + </td> |
| 50 | + <td class="value-style"> |
| 51 | + <span>{{ |
| 52 | + (prop.default === '' ? "''" : prop.default) ?? |
| 53 | + 'undefined' |
| 54 | + }}</span> |
| 55 | + </td> |
| 56 | + <td>{{ prop.description }}</td> |
| 57 | + </tr> |
| 58 | + } |
96 | 59 | </tbody> |
97 | 60 | </table> |
98 | 61 | </div> |
| 62 | + <!-- Emits --> |
| 63 | + @if (data[1].emits) { |
| 64 | + <div> |
| 65 | + <h2>Events</h2> |
| 66 | + <p>{{ data[1].emits.description }}</p> |
| 67 | + <div> |
| 68 | + <table class="data-table"> |
| 69 | + <thead> |
| 70 | + <th>Name</th> |
| 71 | + <th>Parameters</th> |
| 72 | + <th>Description</th> |
| 73 | + </thead> |
| 74 | + <tbody> |
| 75 | + @for (event of data[1].emits.values; track event) { |
| 76 | + <tr> |
| 77 | + <td class="highlighted-bg"> |
| 78 | + <span>{{ event.name }}</span> |
| 79 | + </td> |
| 80 | + <td class="highlighted-text"> |
| 81 | + @if ( |
| 82 | + event.parameters[0].type | detectType: TypesMap; |
| 83 | + as type |
| 84 | + ) { |
| 85 | + <a |
| 86 | + [routerLink]="'/' + TypesMap[type] + '/api'" |
| 87 | + fragment="{{ type }}" |
| 88 | + >{{ event.parameters[0].type }}</a |
| 89 | + > |
| 90 | + } @else { |
| 91 | + <span>{{ event.parameters[0].type }}</span> |
| 92 | + } |
| 93 | + </td> |
| 94 | + <td>{{ event.description }}</td> |
| 95 | + </tr> |
| 96 | + } |
| 97 | + </tbody> |
| 98 | + </table> |
| 99 | + </div> |
| 100 | + </div> |
| 101 | + } |
99 | 102 | </div> |
100 | 103 | </div> |
101 | | - </div> |
| 104 | + } |
102 | 105 | <!-- Types --> |
103 | | - <div |
104 | | - *ngIf=" |
105 | | - componentData.types && |
106 | | - componentData.types.values && |
107 | | - componentData.types.values.length > 0 |
108 | | - "> |
109 | | - <h2>Types</h2> |
110 | | - <p>{{ componentData.types.description }}</p> |
111 | | - <div> |
112 | | - <table class="data-table"> |
113 | | - <thead> |
114 | | - <th>Name</th> |
115 | | - <th>Values</th> |
116 | | - <th>Description</th> |
117 | | - </thead> |
118 | | - <tbody> |
119 | | - <tr |
120 | | - *ngFor="let type of componentData.types.values" |
121 | | - id="{{ type.name }}"> |
122 | | - <td class="highlighted-bg"> |
123 | | - <span>{{ type.name }}</span> |
124 | | - </td> |
125 | | - <td class="highlighted-text"> |
126 | | - {{ type.value }} |
127 | | - </td> |
128 | | - <td>{{ type.description }}</td> |
129 | | - </tr> |
130 | | - </tbody> |
131 | | - </table> |
132 | | - </div> |
133 | | - </div> |
134 | | - </ng-container> |
135 | | - <!-- Interfaces --> |
136 | | - <div |
137 | | - *ngIf=" |
138 | | - componentData.interfaces && |
139 | | - componentData.interfaces.values && |
140 | | - componentData.interfaces.values.length > 0 |
141 | | - "> |
142 | | - <h2>Interfaces</h2> |
143 | | - <p>{{ componentData.interfaces.description }}</p> |
144 | | - @for ( |
145 | | - interface of componentData.interfaces.values; |
146 | | - track interface.name |
| 106 | + @if ( |
| 107 | + componentData.types && |
| 108 | + componentData.types.values && |
| 109 | + componentData.types.values.length > 0 |
147 | 110 | ) { |
148 | | - <div id="{{ interface.name }}"> |
149 | | - <h3>{{ interface.name }}</h3> |
150 | | - <p>{{ interface.description }}</p> |
151 | | - <table class="data-table"> |
152 | | - <thead> |
153 | | - <th>Name</th> |
154 | | - <th>Type</th> |
155 | | - <th>Description</th> |
156 | | - </thead> |
157 | | - <tbody> |
158 | | - <tr *ngFor="let prop of interface.props"> |
159 | | - <td class="highlighted-bg"> |
160 | | - <span>{{ prop.name }}</span> |
161 | | - </td> |
162 | | - <td class="highlighted-text"> |
163 | | - <a |
164 | | - *ngIf=" |
165 | | - prop.type | detectType: TypesMap as type; |
166 | | - else simpleType3 |
167 | | - " |
168 | | - [routerLink]="'/' + TypesMap[type] + '/api'" |
169 | | - fragment="{{ type }}" |
170 | | - >{{ prop.type }}</a |
171 | | - > |
172 | | - <ng-template #simpleType3> |
173 | | - <span>{{ prop.type }}</span> |
174 | | - </ng-template> |
175 | | - </td> |
176 | | - <td>{{ prop.description }}</td> |
177 | | - </tr> |
178 | | - </tbody> |
179 | | - </table> |
| 111 | + <div> |
| 112 | + <h2>Types</h2> |
| 113 | + <p>{{ componentData.types.description }}</p> |
| 114 | + <div> |
| 115 | + <table class="data-table"> |
| 116 | + <thead> |
| 117 | + <th>Name</th> |
| 118 | + <th>Values</th> |
| 119 | + <th>Description</th> |
| 120 | + </thead> |
| 121 | + <tbody> |
| 122 | + @for (type of componentData.types.values; track type) { |
| 123 | + <tr id="{{ type.name }}"> |
| 124 | + <td class="highlighted-bg"> |
| 125 | + <span>{{ type.name }}</span> |
| 126 | + </td> |
| 127 | + <td class="highlighted-text"> |
| 128 | + {{ type.value }} |
| 129 | + </td> |
| 130 | + <td>{{ type.description }}</td> |
| 131 | + </tr> |
| 132 | + } |
| 133 | + </tbody> |
| 134 | + </table> |
| 135 | + </div> |
180 | 136 | </div> |
181 | 137 | } |
182 | | - </div> |
| 138 | + } |
| 139 | + <!-- Interfaces --> |
| 140 | + @if ( |
| 141 | + componentData.interfaces && |
| 142 | + componentData.interfaces.values && |
| 143 | + componentData.interfaces.values.length > 0 |
| 144 | + ) { |
| 145 | + <div> |
| 146 | + <h2>Interfaces</h2> |
| 147 | + <p>{{ componentData.interfaces.description }}</p> |
| 148 | + @for ( |
| 149 | + interface of componentData.interfaces.values; |
| 150 | + track interface.name |
| 151 | + ) { |
| 152 | + <div id="{{ interface.name }}"> |
| 153 | + <h3>{{ interface.name }}</h3> |
| 154 | + <p>{{ interface.description }}</p> |
| 155 | + <table class="data-table"> |
| 156 | + <thead> |
| 157 | + <th>Name</th> |
| 158 | + <th>Type</th> |
| 159 | + <th>Description</th> |
| 160 | + </thead> |
| 161 | + <tbody> |
| 162 | + @for (prop of interface.props; track prop) { |
| 163 | + <tr> |
| 164 | + <td class="highlighted-bg"> |
| 165 | + <span>{{ prop.name }}</span> |
| 166 | + </td> |
| 167 | + <td class="highlighted-text"> |
| 168 | + @if (prop.type | detectType: TypesMap; as type) { |
| 169 | + <a |
| 170 | + [routerLink]="'/' + TypesMap[type] + '/api'" |
| 171 | + fragment="{{ type }}" |
| 172 | + >{{ prop.type }}</a |
| 173 | + > |
| 174 | + } @else { |
| 175 | + <span>{{ prop.type }}</span> |
| 176 | + } |
| 177 | + </td> |
| 178 | + <td>{{ prop.description }}</td> |
| 179 | + </tr> |
| 180 | + } |
| 181 | + </tbody> |
| 182 | + </table> |
| 183 | + </div> |
| 184 | + } |
| 185 | + </div> |
| 186 | + } |
183 | 187 | <!-- Enums --> |
184 | 188 | <app-enums [enums]="componentData.enums"></app-enums> |
185 | | - </ng-container> |
| 189 | + } |
186 | 190 | </cps-tab> |
187 | 191 | </cps-tab-group> |
0 commit comments