-
Notifications
You must be signed in to change notification settings - Fork 0
/
form-demo.component.ts
80 lines (76 loc) · 1.44 KB
/
form-demo.component.ts
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
import { Component } from '@angular/core';
import { Field, Form, Item } from '@ec.components/core';
import { DefaultInputComponent } from '@ec.components/ui';
import { mocked } from '../../mocks/data';
import { CounterComponent } from './counter.component';
@Component({
selector: 'ec-form-demo',
templateUrl: './form-demo.component.html',
})
export class FormDemoComponent {
tree: Item<any>;
public mocked = mocked;
myString;
myNumber;
myTextarea;
myColor;
myBoolean;
myEmail;
myUrl;
myToggle;
myDate;
mySelect;
mySelect2;
myEntry;
myNan;
testField = new Field('test', {
view: 'string',
input: DefaultInputComponent
});
layoutDemoConfig = {
fields: {
forename: {
view: 'string',
columns: 6
},
lastname: {
view: 'string',
columns: 6
},
street: {
view: 'string',
columns: 4
},
plz: {
view: 'string',
columns: 4
},
city: {
view: 'string',
columns: 4
},
count: {
view: 'number',
create: false
},
delivered: {
view: 'boolean',
readonly: true,
prefill: true
}
}
};
customFormConfig = {
fields: {
count: {
input: CounterComponent
}
}
};
constructor() {
this.tree = mocked.lists.trees.id(0);
}
logValue(form: Form<any>) {
console.log('form value', form.resolve());
}
}