custom-field-control.component.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <div class="clr-form-control" *ngIf="compact">
  2. <label for="basic" class="clr-control-label">{{ label }}</label>
  3. <div class="clr-control-container">
  4. <div class="clr-input-wrapper">
  5. <ng-container *ngIf="hasCustomControl; else standardControls">
  6. <div #customComponentPlaceholder></div>
  7. </ng-container>
  8. <ng-template #standardControls>
  9. <ng-container *ngTemplateOutlet="inputs"></ng-container>
  10. </ng-template>
  11. </div>
  12. </div>
  13. </div>
  14. <vdr-form-field [label]="label" [for]="customField.name" *ngIf="!compact">
  15. <ng-container *ngIf="hasCustomControl; else standardControls">
  16. <div #customComponentPlaceholder></div>
  17. </ng-container>
  18. <ng-template #standardControls>
  19. <ng-container *ngTemplateOutlet="inputs"></ng-container>
  20. </ng-template>
  21. </vdr-form-field>
  22. <ng-template #inputs>
  23. <input
  24. *ngIf="isTextInput"
  25. type="text"
  26. [id]="customField.name"
  27. [pattern]="customField.pattern"
  28. [formControl]="formGroup.get(customField.name)"
  29. [readonly]="readonly"
  30. />
  31. <select
  32. *ngIf="isSelectInput"
  33. clrSelect
  34. [formControl]="formGroup.get(customField.name)"
  35. [disabled]="readonly"
  36. >
  37. <option *ngFor="let option of stringOptions" [value]="option.value">
  38. {{ getLabel(option.value, option.label) }}
  39. </option>
  40. </select>
  41. <input
  42. *ngIf="customField.type === 'int' || customField.type === 'float'"
  43. type="number"
  44. [id]="customField.name"
  45. [min]="min"
  46. [max]="max"
  47. [step]="step"
  48. [formControl]="formGroup.get(customField.name)"
  49. [readonly]="readonly"
  50. />
  51. <clr-toggle-wrapper *ngIf="customField.type === 'boolean'">
  52. <input
  53. type="checkbox"
  54. clrToggle
  55. [id]="customField.name"
  56. [formControl]="formGroup.get(customField.name)"
  57. [readonly]="readonly"
  58. />
  59. </clr-toggle-wrapper>
  60. <vdr-datetime-picker
  61. *ngIf="customField.type === 'datetime'"
  62. [id]="customField.name"
  63. [formControl]="formGroup.get(customField.name)"
  64. [min]="min"
  65. [max]="max"
  66. [readonly]="readonly"
  67. >
  68. </vdr-datetime-picker>
  69. </ng-template>