1 import { Component, Input, OnInit } from '@angular/core';
3 import { CellTemplate } from '../../enum/cell-template.enum';
4 import { CdTableColumn } from '../../models/cd-table-column';
7 * Display the given data in a 2 column data table. The left column
8 * shows the 'key' attribute, the right column the 'value' attribute.
9 * The data table has the following characteristics:
10 * - No header and footer is displayed
11 * - The relation of the width for the columns 'key' and 'value' is 1:3
12 * - The 'key' column is displayed in bold text
15 selector: 'cd-table-key-value',
16 templateUrl: './table-key-value.component.html',
17 styleUrls: ['./table-key-value.component.scss']
19 export class TableKeyValueComponent implements OnInit {
21 columns: Array<CdTableColumn> = [];
24 * An array of objects to be displayed in the data table.
26 @Input() data: Array<object> = [];
29 * The name of the attribute to be displayed as key.
36 * The name of the attribute to be displayed as value.
37 * Defaults to 'value'.
40 @Input() value = 'value';
49 cellTransformation: CellTemplate.bold