58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import {Component} from '@angular/core';
|
|
import {QuestionInterface} from './modules/dyn-form/types/question.interface';
|
|
|
|
@Component({
|
|
selector: 'my-app',
|
|
templateUrl: './app.component.html'
|
|
})
|
|
export class AppComponent {
|
|
public formQuestions: QuestionInterface[] = [
|
|
{
|
|
type: 'flag',
|
|
description: 'This is a help tooltip',
|
|
properties: {
|
|
key: 'flags',
|
|
label: 'Form Type Flags',
|
|
order: 1,
|
|
|
|
// dropdown && flags
|
|
options: [{key: 'alpha', value: 'A'}, {key: 'beta', value: 'B'}, {key: 'gamma', value: 'C'}, {key: 'delta', value: 'D'}]
|
|
}, constraints: {
|
|
optional: true
|
|
}
|
|
}, {
|
|
type: 'dropdown',
|
|
description: 'Cool dropdown',
|
|
properties: {
|
|
key: 'cooldrop',
|
|
label: 'Dropdown',
|
|
order: 2,
|
|
methods: ['insert'],
|
|
|
|
// dropdown
|
|
options: [{key: 'hello', value: 'Hallo'}, {key: 'world', value: 'World'}, {key: 'and', value: 'And'}, {key: 'u', value: 'You'}]
|
|
}, constraints: {
|
|
optional: false
|
|
}
|
|
}, {
|
|
type: 'hidden',
|
|
description: 'ID',
|
|
properties: {
|
|
key: 'ID',
|
|
order: 3
|
|
}, constraints: {
|
|
optional: false
|
|
}
|
|
}
|
|
];
|
|
public formValue = {
|
|
flags: {gamma: true},
|
|
ID: 5,
|
|
cooldrop: 'u'
|
|
};
|
|
|
|
submit(value: any) {
|
|
console.log('send', value);
|
|
}
|
|
}
|