-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathimperative.ts
38 lines (35 loc) · 1.11 KB
/
imperative.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
import { openForm } from '../imperativeInterface.js';
import { FormProps } from '../types.js';
const form: FormProps = {
form: {
title: "Form title",
sections: [
{
title: "Text fields",
fields: [
{type: 'string', name: 'field1', label: 'Input with initial value', initialValue: 'Initial value'},
{type: 'string', name: 'field2', label: 'Masked input', mask: '*'},
{
type: 'string',
name: 'field3',
label: 'Input with placeholder, description and required flag',
placeholder: 'Placeholder',
required: true,
description: 'Hello I am a description'
},
{type: 'string', name: 'field4-nolabel'},
{
type: 'string',
name: 'field5',
label: 'Regex, must be an url',
regex: /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/
},
]
},
]
}
};
(async () => {
const result = await openForm(form);
console.log(`Finished with value`, result);
})();