// Angular imports // import { Component, Input } from '@angular/core'; import { downgradeComponent } from '@angular/upgrade/static'; declare const angular: angular.IAngularStatic; // Components // // Interfaces // // Services // // Directives // // Filters // // Utilities // import { Guid } from '@fb/statics/statics/guid'; /** * Visar ett read-only textfält. * * Syntax: * * * @param label Label att visa. Visas inte om noLabel är satt * @param autoHide Sätt till true för att dölja fältet om det saknar värde * @param model Värde som ska visas. Kan inte vara av typen ChangeTrack. * @param noLabel Sätt till true för att dölja label */ @Component({ selector: 'fb-text', templateUrl: './fb-text.component.html' }) export class FbTextComponent { @Input() label: string; @Input() autoHide: boolean = false; @Input() noLabel: boolean; @Input() model: any; readonly inputId: string = Guid.new(); hidden(): boolean { return this.autoHide && this.missValue(); } missValue(): boolean { return this.model === null || this.model === ''; } } // Angular downgrade //// angular.module('fasit') .directive('fbText', downgradeComponent({ component: FbTextComponent, inputs: ['label', 'autoHide', 'noLabel'], outputs: [] }));