@gravitywiz/types 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +74 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -7,21 +7,68 @@ declare global {
|
|
|
7
7
|
// TODO type ...any better (e.g. provide a way to for the caller to declare what these arguments should be).
|
|
8
8
|
type GFHookCallback = (...args: any[]) => void;
|
|
9
9
|
|
|
10
|
-
type GFFieldType =
|
|
10
|
+
type GFFieldType =
|
|
11
|
+
| 'text'
|
|
12
|
+
| 'date'
|
|
13
|
+
| 'website'
|
|
14
|
+
| 'email'
|
|
15
|
+
| 'phone'
|
|
16
|
+
| 'survey';
|
|
17
|
+
|
|
18
|
+
type GFInputType =
|
|
19
|
+
| 'text'
|
|
20
|
+
| 'number'
|
|
21
|
+
| 'email'
|
|
22
|
+
| 'fileupload'
|
|
23
|
+
| 'date'
|
|
24
|
+
| 'website'
|
|
25
|
+
| 'total'
|
|
26
|
+
| 'rating'
|
|
27
|
+
| 'radio'
|
|
28
|
+
| 'select'
|
|
29
|
+
| 'singleproduct'
|
|
30
|
+
| 'hiddenproduct'
|
|
31
|
+
| 'calculation'
|
|
32
|
+
| 'singleshipping'
|
|
33
|
+
| 'donation'
|
|
34
|
+
| 'price'
|
|
35
|
+
| 'consent'
|
|
36
|
+
|
|
37
|
+
interface GFFieldInput {
|
|
38
|
+
id: string | number;
|
|
39
|
+
label: string;
|
|
40
|
+
name: string;
|
|
41
|
+
isHidden?: boolean;
|
|
42
|
+
key?: string;
|
|
43
|
+
autoComplete?: string;
|
|
44
|
+
}
|
|
11
45
|
|
|
12
|
-
|
|
46
|
+
class Input implements GFFieldInput {
|
|
47
|
+
constructor(
|
|
48
|
+
id: string | number,
|
|
49
|
+
label?: string,
|
|
50
|
+
autocompleteAttribute?: string,
|
|
51
|
+
);
|
|
52
|
+
id: string | number;
|
|
53
|
+
label: string;
|
|
54
|
+
name: string;
|
|
55
|
+
isHidden?: boolean;
|
|
56
|
+
key?: string;
|
|
57
|
+
autoComplete?: string;
|
|
58
|
+
}
|
|
13
59
|
|
|
14
60
|
interface GFBaseField {
|
|
15
|
-
inputs: any;
|
|
16
|
-
choices?: GFChoice[];
|
|
17
|
-
label: string;
|
|
18
|
-
adminLabel?: string;
|
|
19
61
|
id: number;
|
|
20
62
|
formId: number;
|
|
21
63
|
type: GFFieldType;
|
|
64
|
+
inputs?: GFFieldInput[] | null;
|
|
65
|
+
choices?: GFChoice[];
|
|
66
|
+
label: string;
|
|
67
|
+
adminLabel?: string;
|
|
22
68
|
enableEnhancedUI?: boolean;
|
|
23
69
|
inputType: GFInputType;
|
|
24
70
|
productId: string;
|
|
71
|
+
validateState?: boolean;
|
|
25
72
|
}
|
|
26
73
|
|
|
27
74
|
type GFSurveyField = GFBaseField & {
|
|
@@ -30,15 +77,30 @@ declare global {
|
|
|
30
77
|
gsurveyLikertRows?: { text: string; value: string }[];
|
|
31
78
|
}
|
|
32
79
|
|
|
33
|
-
type GFField = GFBaseField | GFSurveyField;
|
|
80
|
+
type GFField<Extra = {}> = (GFBaseField | GFSurveyField) & Extra;
|
|
34
81
|
|
|
35
82
|
interface GFChoice {
|
|
83
|
+
text: string;
|
|
84
|
+
value: string | number;
|
|
36
85
|
isSelected?: boolean;
|
|
37
|
-
price?: string;
|
|
86
|
+
price?: string | number;
|
|
87
|
+
key?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class Choice implements GFChoice {
|
|
91
|
+
constructor(
|
|
92
|
+
text: string,
|
|
93
|
+
value?: string | number,
|
|
94
|
+
price?: string | number
|
|
95
|
+
);
|
|
38
96
|
text: string;
|
|
39
|
-
value: string;
|
|
97
|
+
value: string | number;
|
|
98
|
+
isSelected?: boolean;
|
|
99
|
+
price?: string | number;
|
|
100
|
+
key?: string;
|
|
40
101
|
}
|
|
41
102
|
|
|
103
|
+
|
|
42
104
|
interface GFForm {
|
|
43
105
|
button: {
|
|
44
106
|
type: string;
|
|
@@ -240,6 +302,8 @@ declare global {
|
|
|
240
302
|
[key: string]: any
|
|
241
303
|
};
|
|
242
304
|
|
|
305
|
+
GenerateUniqueFieldKey: () => string;
|
|
306
|
+
|
|
243
307
|
// Placeholders
|
|
244
308
|
mOxie: any;
|
|
245
309
|
gf_raw_input_change: any;
|
|
@@ -273,6 +337,7 @@ declare global {
|
|
|
273
337
|
|
|
274
338
|
gformFormat: (...format: any[]) => string;
|
|
275
339
|
}
|
|
340
|
+
|
|
276
341
|
}
|
|
277
342
|
|
|
278
343
|
export {};
|