1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16import {Component, Input} from '@angular/core'; 17import {TableProperties} from 'viewers/common/table_properties'; 18 19@Component({ 20 selector: 'properties-table', 21 template: ` 22 <table class="table" *ngIf="properties !== undefined"> 23 <tr *ngFor="let entry of objectEntries(properties)"> 24 <td class="table-cell-name"> 25 <p class="mat-body-1">{{ entry[0] }}</p> 26 </td> 27 <td class="table-cell-value"> 28 <p class="mat-body-1">{{ entry[1] != undefined ? entry[1] : 'undefined' }}</p> 29 </td> 30 </tr> 31 </table> 32 `, 33 styles: [ 34 ` 35 .table { 36 width: 100%; 37 border-collapse: collapse; 38 } 39 40 .table-cell-name, 41 .table-cell-value { 42 padding: 1px 5px; 43 border: 1px solid var(--border-color); 44 overflow-wrap: anywhere; 45 } 46 47 .table-cell-name { 48 width: 20%; 49 background-color: rgba(158, 192, 200, 0.281); 50 } 51 `, 52 ], 53}) 54export class PropertiesTableComponent { 55 objectEntries = Object.entries; 56 57 @Input() properties: TableProperties | undefined; 58} 59