-
Notifications
You must be signed in to change notification settings - Fork 0
/
default-input.component.html
106 lines (96 loc) · 3.06 KB
/
default-input.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<div [ngSwitch]="field.getView('input')" *ngIf="group" [formGroup]="group" class="ec-input">
<input
[id]="field.id"
*ngSwitchCase="'string'"
type="text"
[formControl]="control"
[placeholder]="field.getPlaceholder()"
class="input"
[ecFocus]="focusEvent"
/>
<textarea
[id]="field.id"
*ngSwitchCase="'textarea'"
type="text"
[formControl]="control"
[placeholder]="field.getPlaceholder()"
class="input"
[ecFocus]="focusEvent"
></textarea>
<input
[id]="field.id"
*ngSwitchCase="'number'"
type="number"
[formControl]="control"
[placeholder]="field.getPlaceholder()"
class="input"
[ecFocus]="focusEvent"
/>
<div class="ec-input-color" *ngSwitchCase="'color'">
<div class="ec-input-color__preview" [style.backgroundColor]="control.value">
<input [id]="field.id" type="color" [formControl]="control" />
</div>
<input type="text" [formControl]="control" [placeholder]="field.getPlaceholder()" class="input" />
</div>
<label *ngSwitchCase="'boolean'">
<input [id]="field.id" type="checkbox" [formControl]="control" />
{{ field.getPlaceholder() }}
</label>
<input
[id]="field.id"
*ngSwitchCase="'email'"
type="email"
[formControl]="control"
[placeholder]="field.getPlaceholder()"
class="input"
[ecFocus]="focusEvent"
/>
<input
[id]="field.id"
*ngSwitchCase="'url'"
type="url"
[formControl]="control"
[placeholder]="field.getPlaceholder()"
class="input"
[ecFocus]="focusEvent"
/>
<ec-toggle [id]="field.id" *ngSwitchCase="'toggle'" [formControl]="control" [placeholder]="field.getPlaceholder()">
</ec-toggle>
<ec-datetime *ngSwitchCase="'date'" [formControl]="control" [placeholder]="field.getPlaceholder()"></ec-datetime>
<div *ngSwitchCase="'select'">
<select
[id]="field.id"
[formControl]="control"
[ecFocus]="focusEvent"
(change)="control.patchValue($event.target.value)"
class="input"
*ngIf="!formService.isReadOnly(field, item)"
>
<option>{{ field.getPlaceholder() }}</option>
<option
*ngFor="let option of field.values"
[selected]="control.value === (option.value ? option.value : option)"
[value]="option.value ? option.value : option"
>
{{ option.label ? option.label : option }}
</option>
</select>
<input type="text" [formControl]="control" [id]="field.id" class="is-hidden-input" />
{{ formService.isReadOnly(field, item) ? field.display() : '' }}
</div>
<div *ngSwitchCase="'copy'">
<div
*ngIf="!!item?.display(field.property)"
class="tag"
style="cursor: pointer"
(click)="keycommands.copyToClipBoard(item?.transform('copy', field.property), field.getLabel())"
[attr.data-tooltip-bottom]="'click to copy ' + field.getLabel()"
>
{{ item?.display(field.property) }}
</div>
</div>
<div *ngSwitchDefault>
<ec-output [field]="field" [item]="item"></ec-output>
</div>
<ec-input-errors [control]="group.get(field.property)"></ec-input-errors>
</div>