1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export interface BaseField<TType extends string, TValue> {
|
8 | |
9 |
|
10 |
|
11 |
|
12 |
|
13 | name: string;
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 | type: TType;
|
20 | |
21 |
|
22 |
|
23 | value?: TValue;
|
24 | |
25 |
|
26 |
|
27 | placeholder?: TValue;
|
28 | |
29 |
|
30 |
|
31 | required: boolean;
|
32 | |
33 |
|
34 |
|
35 | readOnly: boolean;
|
36 | |
37 |
|
38 |
|
39 | label?: string;
|
40 | }
|
41 |
|
42 |
|
43 |
|
44 | export declare type Checkbox = BaseField<'checkbox', boolean>;
|
45 |
|
46 |
|
47 |
|
48 | export declare type Color = BaseField<'color', string>;
|
49 |
|
50 |
|
51 |
|
52 | export declare type Date = BaseField<'date', string>;
|
53 |
|
54 |
|
55 |
|
56 | export declare type DateTime = BaseField<'datetime', Date>;
|
57 | export declare type DateTimeLocal = BaseField<'datetime-local', Date>;
|
58 | export declare type Email = BaseField<'email', string>;
|
59 | export declare type File = BaseField<'file', never>;
|
60 | export declare type Hidden = BaseField<'hidden', string>;
|
61 | export interface Number extends BaseField<'number', number> {
|
62 | max?: number;
|
63 | min?: number;
|
64 | step?: number;
|
65 | }
|
66 | export declare type Month = BaseField<'month', string>;
|
67 | export declare type Password = BaseField<'password', string>;
|
68 | export interface Radio extends BaseField<'radio', string> {
|
69 | options?: Map<string, string>;
|
70 | }
|
71 | export interface Range extends BaseField<'range', number> {
|
72 | max?: number;
|
73 | min?: number;
|
74 | step?: number;
|
75 | }
|
76 | export declare type Search = BaseField<'search', string>;
|
77 | export declare type Tel = BaseField<'tel', string>;
|
78 | export interface Text extends BaseField<'text', string> {
|
79 | minLength?: number;
|
80 | maxLength?: number;
|
81 | pattern?: RegExp;
|
82 | options?: Map<string, string>;
|
83 | }
|
84 | export declare type Time = BaseField<'time', string>;
|
85 | export declare type Url = BaseField<'url', string>;
|
86 | export declare type Week = BaseField<'week', string>;
|
87 | export declare type Field = Checkbox | Color | Date | DateTime | DateTimeLocal | Email | File | Hidden | Number | Month | Password | Radio | Range | Search | Tel | Text | Time | Url | Week;
|