Skip to content
Snippets Groups Projects
text-field-simple.component.ts 1.2 KiB
Newer Older
  • Learn to ignore specific revisions
  • rhenck's avatar
    rhenck committed
    import { Component, Input } from '@angular/core';
    
    import { FormElementComponent } from '../../directives/form-element-component.directive';
    import { TextFieldSimpleElement } from './text-field-simple-element';
    
    rhenck's avatar
    rhenck committed
    
    @Component({
      selector: 'app-text-field-simple',
      template: `
        <input type="text" form="parentForm"
               [style.width.px]="elementModel.width"
               [style.height.px]="elementModel.height"
    
               [style.line-height.px]="elementModel.fontProps.fontSize"
               [style.color]="elementModel.fontProps.fontColor"
               [style.font-family]="elementModel.fontProps.font"
               [style.font-size.px]="elementModel.fontProps.fontSize"
               [style.font-weight]="elementModel.fontProps.bold ? 'bold' : ''"
               [style.font-style]="elementModel.fontProps.italic ? 'italic' : ''"
               [style.text-decoration]="elementModel.fontProps.underline ? 'underline' : ''"
    
    rhenck's avatar
    rhenck committed
               value="{{elementModel.value}}"
               (input)="setFormValue($any($event.target).value)">
    
      `,
      styles: [
        'input {border: 1px solid rgba(0,0,0,.12); border-radius: 5px}'
      ]
    
    rhenck's avatar
    rhenck committed
    })
    export class TextFieldSimpleComponent extends FormElementComponent {
      @Input() elementModel!: TextFieldSimpleElement;
    }