/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Component, computed, input, output, ChangeDetectionStrategy} from '@angular/core'; import {JsonPipe, NgTemplateOutlet} from '@angular/common'; import {MatIcon} from '@angular/material/icon'; import {ButtonComponent} from '../../shared/button/button.component'; import {RouterTreeNode} from './router-tree-fns'; import {MatTooltip} from '@angular/material/tooltip'; export type RowType = 'text' | 'flag' | 'list'; export type ActionBtnType = 'none' | 'view-source' | 'navigate'; @Component({ selector: '[ng-route-details-row]', templateUrl: './route-details-row.component.html', styleUrls: ['./route-details-row.component.scss'], imports: [NgTemplateOutlet, ButtonComponent, JsonPipe, MatIcon, MatTooltip], changeDetection: ChangeDetectionStrategy.OnPush, }) export class RouteDetailsRowComponent { readonly label = input.required(); readonly data = input.required(); readonly dataKey = input.required(); readonly renderValueAsJson = input(false); readonly type = input('text'); readonly actionBtnType = input('none'); readonly actionBtnTooltip = input(''); readonly actionBtnDisabled = input(false); readonly actionBtnClick = output(); readonly rowValue = computed(() => { return this.data()[this.dataKey() as keyof RouterTreeNode]; }); readonly dataArray = computed(() => { if (!this.data() || !this.dataKey()) { return []; } return this.rowValue(); }); }