Skip to content
Snippets Groups Projects
text-field-simple.component.ts 1.17 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 '../../interfaces/elements';
    
    rhenck's avatar
    rhenck committed
    
    @Component({
    
      selector: 'aspect-text-field-simple',
    
    rhenck's avatar
    rhenck committed
      template: `
        <input type="text" form="parentForm"
               [style.width.px]="elementModel.width"
               [style.height.px]="elementModel.height"
    
    rhenck's avatar
    rhenck committed
               [style.line-height.px]="elementModel.styles.fontSize"
               [style.color]="elementModel.styles.fontColor"
               [style.font-family]="elementModel.styles.font"
               [style.font-size.px]="elementModel.styles.fontSize"
               [style.font-weight]="elementModel.styles.bold ? 'bold' : ''"
               [style.font-style]="elementModel.styles.italic ? 'italic' : ''"
               [style.text-decoration]="elementModel.styles.underline ? 'underline' : ''"
    
               [formControl]="elementFormControl"
               value="{{elementModel.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;
    }