@prismicio/types-internal 2.5.0-alpha.0 → 2.5.0-alpha.2
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/lib/content/Document.d.ts +3972 -7926
- package/lib/content/fields/GroupContent.d.ts +17 -1754
- package/lib/content/fields/GroupContent.js +62 -22
- package/lib/content/fields/WidgetContent.d.ts +3371 -7324
- package/lib/content/fields/nestable/NestableContent.d.ts +3 -145
- package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +4 -212
- package/lib/content/fields/nestable/RichTextContent/Blocks.js +2 -0
- package/lib/content/fields/nestable/RichTextContent/index.d.ts +4 -184
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +6 -290
- package/lib/content/fields/slices/Slice/CompositeSliceContent.js +3 -0
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +2 -383
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +15 -1333
- package/lib/content/fields/slices/Slice/SharedSliceContent.js +2 -0
- package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +7 -1182
- package/lib/content/fields/slices/Slice/SimpleSliceContent.js +1 -0
- package/lib/content/fields/slices/Slice/SlicePrimaryContent.d.ts +7 -1182
- package/lib/content/fields/slices/Slice/index.d.ts +983 -2935
- package/lib/content/fields/slices/SliceItem.d.ts +148 -2100
- package/lib/content/fields/slices/SlicesContent.d.ts +866 -3644
- package/lib/content/fields/withDefaultValues.d.ts +4 -3
- package/lib/content/fields/withDefaultValues.js +17 -1
- package/lib/customtypes/CustomType.d.ts +70 -915
- package/lib/customtypes/Section.d.ts +70 -915
- package/lib/customtypes/diff/SharedSlice.d.ts +2 -340
- package/lib/customtypes/diff/Variation.d.ts +4 -351
- package/lib/customtypes/diff/Variation.js +4 -3
- package/lib/customtypes/diff/Widgets.d.ts +11 -0
- package/lib/customtypes/diff/Widgets.js +2 -0
- package/lib/customtypes/diff/index.d.ts +1 -0
- package/lib/customtypes/diff/index.js +1 -0
- package/lib/customtypes/widgets/Group.d.ts +15 -331
- package/lib/customtypes/widgets/Group.js +25 -5
- package/lib/customtypes/widgets/Widget.d.ts +7 -1014
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +2 -168
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +2 -336
- package/lib/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +3 -338
- package/lib/customtypes/widgets/slices/Slices.d.ts +7 -1184
- package/lib/validators/function.js +8 -1
- package/package.json +5 -5
- package/src/content/fields/GroupContent.ts +107 -32
- package/src/content/fields/nestable/RichTextContent/Blocks.ts +3 -1
- package/src/content/fields/slices/Slice/CompositeSliceContent.ts +7 -4
- package/src/content/fields/slices/Slice/SharedSliceContent.ts +5 -3
- package/src/content/fields/slices/Slice/SimpleSliceContent.ts +3 -1
- package/src/content/fields/withDefaultValues.ts +27 -3
- package/src/customtypes/diff/Variation.ts +9 -20
- package/src/customtypes/diff/Widgets.ts +17 -0
- package/src/customtypes/diff/index.ts +1 -0
- package/src/customtypes/widgets/Group.ts +66 -20
- package/src/validators/function.ts +11 -1
|
@@ -1,333 +1,17 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
+
import { NestableWidget } from "./nestable/NestableWidget";
|
|
2
3
|
export declare const GroupFieldType = "Group";
|
|
3
|
-
export declare const GroupConfig: t.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
config: t.ExactC<t.PartialC<{
|
|
18
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
19
|
-
default_value: t.BooleanC;
|
|
20
|
-
placeholder_true: t.StringC;
|
|
21
|
-
placeholder_false: t.StringC;
|
|
22
|
-
}>>;
|
|
23
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
24
|
-
type: t.LiteralC<"Embed">;
|
|
25
|
-
}>, t.PartialC<{
|
|
26
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
27
|
-
config: t.ExactC<t.PartialC<{
|
|
28
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
29
|
-
placeholder: t.StringC;
|
|
30
|
-
useAsTitle: t.BooleanC;
|
|
31
|
-
}>>;
|
|
32
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
33
|
-
type: t.LiteralC<"GeoPoint">;
|
|
34
|
-
}>, t.PartialC<{
|
|
35
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
36
|
-
config: t.ExactC<t.PartialC<{
|
|
37
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
38
|
-
}>>;
|
|
39
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
40
|
-
type: t.LiteralC<"Date">;
|
|
41
|
-
}>, t.PartialC<{
|
|
42
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
43
|
-
config: t.ExactC<t.PartialC<{
|
|
44
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
45
|
-
placeholder: t.StringC;
|
|
46
|
-
default: t.StringC;
|
|
47
|
-
}>>;
|
|
48
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
49
|
-
type: t.LiteralC<"Number">;
|
|
50
|
-
}>, t.PartialC<{
|
|
51
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
52
|
-
config: t.ExactC<t.PartialC<{
|
|
53
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
54
|
-
placeholder: t.StringC;
|
|
55
|
-
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
56
|
-
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
57
|
-
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
58
|
-
}>>;
|
|
59
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
60
|
-
type: t.LiteralC<"Range">;
|
|
61
|
-
}>, t.PartialC<{
|
|
62
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
63
|
-
config: t.ExactC<t.PartialC<{
|
|
64
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
65
|
-
placeholder: t.StringC;
|
|
66
|
-
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
67
|
-
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
68
|
-
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
69
|
-
}>>;
|
|
70
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
71
|
-
type: t.LiteralC<"StructuredText">;
|
|
72
|
-
}>, t.PartialC<{
|
|
73
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
74
|
-
config: t.ExactC<t.PartialC<{
|
|
75
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
76
|
-
placeholder: t.StringC;
|
|
77
|
-
useAsTitle: t.BooleanC;
|
|
78
|
-
single: t.Type<string, string, unknown>;
|
|
79
|
-
multi: t.Type<string, string, unknown>;
|
|
80
|
-
imageConstraint: t.PartialC<{
|
|
81
|
-
width: t.Type<number | null, unknown, unknown>;
|
|
82
|
-
height: t.Type<number | null, unknown, unknown>;
|
|
83
|
-
}>;
|
|
84
|
-
labels: t.Type<readonly string[], object, unknown>;
|
|
85
|
-
allowTargetBlank: t.BooleanC;
|
|
86
|
-
}>>;
|
|
87
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
88
|
-
type: t.LiteralC<"Select">;
|
|
89
|
-
}>, t.PartialC<{
|
|
90
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
91
|
-
config: t.ExactC<t.PartialC<{
|
|
92
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
93
|
-
placeholder: t.StringC;
|
|
94
|
-
default_value: t.StringC;
|
|
95
|
-
options: t.ReadonlyArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>;
|
|
96
|
-
}>>;
|
|
97
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
98
|
-
type: t.LiteralC<"Separator">;
|
|
99
|
-
}>, t.PartialC<{
|
|
100
|
-
config: t.ExactC<t.PartialC<{
|
|
101
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
102
|
-
}>>;
|
|
103
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
104
|
-
type: t.LiteralC<"Text">;
|
|
105
|
-
}>, t.PartialC<{
|
|
106
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
107
|
-
config: t.ExactC<t.PartialC<{
|
|
108
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
109
|
-
useAsTitle: t.BooleanC;
|
|
110
|
-
placeholder: t.StringC;
|
|
111
|
-
}>>;
|
|
112
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
113
|
-
type: t.LiteralC<"Timestamp">;
|
|
114
|
-
}>, t.PartialC<{
|
|
115
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
116
|
-
config: t.ExactC<t.PartialC<{
|
|
117
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
118
|
-
placeholder: t.StringC;
|
|
119
|
-
default: t.StringC;
|
|
120
|
-
}>>;
|
|
121
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
122
|
-
type: t.LiteralC<"Link">;
|
|
123
|
-
}>, t.PartialC<{
|
|
124
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
125
|
-
config: t.ExactC<t.PartialC<{
|
|
126
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
127
|
-
useAsTitle: t.BooleanC;
|
|
128
|
-
placeholder: t.StringC;
|
|
129
|
-
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
130
|
-
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
131
|
-
masks: t.Type<readonly string[], object, unknown>;
|
|
132
|
-
tags: t.Type<readonly string[], object, unknown>;
|
|
133
|
-
allowTargetBlank: t.BooleanC;
|
|
134
|
-
}>>;
|
|
135
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
136
|
-
type: t.LiteralC<"Image">;
|
|
137
|
-
}>, t.PartialC<{
|
|
138
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
139
|
-
config: t.ExactC<t.PartialC<{
|
|
140
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
141
|
-
placeholder: t.StringC;
|
|
142
|
-
constraint: t.PartialC<{
|
|
143
|
-
width: t.Type<number | null, unknown, unknown>;
|
|
144
|
-
height: t.Type<number | null, unknown, unknown>;
|
|
145
|
-
}>;
|
|
146
|
-
thumbnails: t.ReadonlyArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
147
|
-
name: t.StringC;
|
|
148
|
-
}>, t.PartialC<{
|
|
149
|
-
width: t.Type<number | null, unknown, unknown>;
|
|
150
|
-
height: t.Type<number | null, unknown, unknown>;
|
|
151
|
-
}>]>>>;
|
|
152
|
-
}>>;
|
|
153
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
154
|
-
type: t.LiteralC<"IntegrationFields">;
|
|
155
|
-
}>, t.PartialC<{
|
|
156
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
157
|
-
config: t.ExactC<t.PartialC<{
|
|
158
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
159
|
-
placeholder: t.StringC;
|
|
160
|
-
catalog: t.StringC;
|
|
161
|
-
}>>;
|
|
162
|
-
}>]>>]>>;
|
|
163
|
-
}>>;
|
|
164
|
-
export declare type GroupConfig = t.TypeOf<typeof GroupConfig>;
|
|
165
|
-
export declare const Group: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
166
|
-
type: t.LiteralC<"Group">;
|
|
167
|
-
}>, t.PartialC<{
|
|
168
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
169
|
-
icon: t.StringC;
|
|
170
|
-
description: t.StringC;
|
|
171
|
-
config: t.ExactC<t.PartialC<{
|
|
172
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
173
|
-
repeat: t.BooleanC;
|
|
174
|
-
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
175
|
-
type: t.LiteralC<"Color">;
|
|
176
|
-
}>, t.PartialC<{
|
|
177
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
178
|
-
config: t.ExactC<t.PartialC<{
|
|
179
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
180
|
-
placeholder: t.StringC;
|
|
181
|
-
}>>;
|
|
182
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
183
|
-
type: t.LiteralC<"Boolean">;
|
|
184
|
-
}>, t.PartialC<{
|
|
185
|
-
config: t.ExactC<t.PartialC<{
|
|
186
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
187
|
-
default_value: t.BooleanC;
|
|
188
|
-
placeholder_true: t.StringC;
|
|
189
|
-
placeholder_false: t.StringC;
|
|
190
|
-
}>>;
|
|
191
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
192
|
-
type: t.LiteralC<"Embed">;
|
|
193
|
-
}>, t.PartialC<{
|
|
194
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
195
|
-
config: t.ExactC<t.PartialC<{
|
|
196
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
197
|
-
placeholder: t.StringC;
|
|
198
|
-
useAsTitle: t.BooleanC;
|
|
199
|
-
}>>;
|
|
200
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
201
|
-
type: t.LiteralC<"GeoPoint">;
|
|
202
|
-
}>, t.PartialC<{
|
|
203
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
204
|
-
config: t.ExactC<t.PartialC<{
|
|
205
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
206
|
-
}>>;
|
|
207
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
208
|
-
type: t.LiteralC<"Date">;
|
|
209
|
-
}>, t.PartialC<{
|
|
210
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
211
|
-
config: t.ExactC<t.PartialC<{
|
|
212
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
213
|
-
placeholder: t.StringC;
|
|
214
|
-
default: t.StringC;
|
|
215
|
-
}>>;
|
|
216
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
217
|
-
type: t.LiteralC<"Number">;
|
|
218
|
-
}>, t.PartialC<{
|
|
219
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
220
|
-
config: t.ExactC<t.PartialC<{
|
|
221
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
222
|
-
placeholder: t.StringC;
|
|
223
|
-
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
224
|
-
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
225
|
-
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
226
|
-
}>>;
|
|
227
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
228
|
-
type: t.LiteralC<"Range">;
|
|
229
|
-
}>, t.PartialC<{
|
|
230
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
231
|
-
config: t.ExactC<t.PartialC<{
|
|
232
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
233
|
-
placeholder: t.StringC;
|
|
234
|
-
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
235
|
-
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
236
|
-
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
237
|
-
}>>;
|
|
238
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
239
|
-
type: t.LiteralC<"StructuredText">;
|
|
240
|
-
}>, t.PartialC<{
|
|
241
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
242
|
-
config: t.ExactC<t.PartialC<{
|
|
243
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
244
|
-
placeholder: t.StringC;
|
|
245
|
-
useAsTitle: t.BooleanC;
|
|
246
|
-
single: t.Type<string, string, unknown>;
|
|
247
|
-
multi: t.Type<string, string, unknown>;
|
|
248
|
-
imageConstraint: t.PartialC<{
|
|
249
|
-
width: t.Type<number | null, unknown, unknown>;
|
|
250
|
-
height: t.Type<number | null, unknown, unknown>;
|
|
251
|
-
}>;
|
|
252
|
-
labels: t.Type<readonly string[], object, unknown>;
|
|
253
|
-
allowTargetBlank: t.BooleanC;
|
|
254
|
-
}>>;
|
|
255
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
256
|
-
type: t.LiteralC<"Select">;
|
|
257
|
-
}>, t.PartialC<{
|
|
258
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
259
|
-
config: t.ExactC<t.PartialC<{
|
|
260
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
261
|
-
placeholder: t.StringC;
|
|
262
|
-
default_value: t.StringC;
|
|
263
|
-
options: t.ReadonlyArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>;
|
|
264
|
-
}>>;
|
|
265
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
266
|
-
type: t.LiteralC<"Separator">;
|
|
267
|
-
}>, t.PartialC<{
|
|
268
|
-
config: t.ExactC<t.PartialC<{
|
|
269
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
270
|
-
}>>;
|
|
271
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
272
|
-
type: t.LiteralC<"Text">;
|
|
273
|
-
}>, t.PartialC<{
|
|
274
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
275
|
-
config: t.ExactC<t.PartialC<{
|
|
276
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
277
|
-
useAsTitle: t.BooleanC;
|
|
278
|
-
placeholder: t.StringC;
|
|
279
|
-
}>>;
|
|
280
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
281
|
-
type: t.LiteralC<"Timestamp">;
|
|
282
|
-
}>, t.PartialC<{
|
|
283
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
284
|
-
config: t.ExactC<t.PartialC<{
|
|
285
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
286
|
-
placeholder: t.StringC;
|
|
287
|
-
default: t.StringC;
|
|
288
|
-
}>>;
|
|
289
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
290
|
-
type: t.LiteralC<"Link">;
|
|
291
|
-
}>, t.PartialC<{
|
|
292
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
293
|
-
config: t.ExactC<t.PartialC<{
|
|
294
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
295
|
-
useAsTitle: t.BooleanC;
|
|
296
|
-
placeholder: t.StringC;
|
|
297
|
-
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
298
|
-
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
299
|
-
masks: t.Type<readonly string[], object, unknown>;
|
|
300
|
-
tags: t.Type<readonly string[], object, unknown>;
|
|
301
|
-
allowTargetBlank: t.BooleanC;
|
|
302
|
-
}>>;
|
|
303
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
304
|
-
type: t.LiteralC<"Image">;
|
|
305
|
-
}>, t.PartialC<{
|
|
306
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
307
|
-
config: t.ExactC<t.PartialC<{
|
|
308
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
309
|
-
placeholder: t.StringC;
|
|
310
|
-
constraint: t.PartialC<{
|
|
311
|
-
width: t.Type<number | null, unknown, unknown>;
|
|
312
|
-
height: t.Type<number | null, unknown, unknown>;
|
|
313
|
-
}>;
|
|
314
|
-
thumbnails: t.ReadonlyArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
315
|
-
name: t.StringC;
|
|
316
|
-
}>, t.PartialC<{
|
|
317
|
-
width: t.Type<number | null, unknown, unknown>;
|
|
318
|
-
height: t.Type<number | null, unknown, unknown>;
|
|
319
|
-
}>]>>>;
|
|
320
|
-
}>>;
|
|
321
|
-
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
322
|
-
type: t.LiteralC<"IntegrationFields">;
|
|
323
|
-
}>, t.PartialC<{
|
|
324
|
-
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
325
|
-
config: t.ExactC<t.PartialC<{
|
|
326
|
-
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
327
|
-
placeholder: t.StringC;
|
|
328
|
-
catalog: t.StringC;
|
|
329
|
-
}>>;
|
|
330
|
-
}>]>>]>>;
|
|
331
|
-
}>>;
|
|
332
|
-
}>]>>;
|
|
333
|
-
export declare type Group = t.TypeOf<typeof Group>;
|
|
4
|
+
export declare const GroupConfig: t.Type<GroupConfig>;
|
|
5
|
+
export declare type GroupConfig = {
|
|
6
|
+
label?: string | null | undefined;
|
|
7
|
+
repeat?: boolean;
|
|
8
|
+
fields?: Record<string, Group | NestableWidget>;
|
|
9
|
+
};
|
|
10
|
+
export declare const Group: t.Type<Group>;
|
|
11
|
+
export declare type Group = {
|
|
12
|
+
type: typeof GroupFieldType;
|
|
13
|
+
fieldset?: string | null | undefined;
|
|
14
|
+
icon?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
config?: GroupConfig;
|
|
17
|
+
};
|
|
@@ -5,14 +5,29 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const common_1 = require("../../common");
|
|
7
7
|
const validators_1 = require("../../validators");
|
|
8
|
+
const function_1 = require("../../validators/function");
|
|
8
9
|
const NestableWidget_1 = require("./nestable/NestableWidget");
|
|
9
10
|
exports.GroupFieldType = "Group";
|
|
10
|
-
exports.GroupConfig = t.exact(t.partial({
|
|
11
|
+
exports.GroupConfig = t.recursion("GroupConfig", () => t.exact(t.partial({
|
|
11
12
|
label: validators_1.StringOrNull,
|
|
12
13
|
repeat: t.boolean,
|
|
13
|
-
fields: t.record(common_1.WidgetKey, NestableWidget_1.NestableWidget),
|
|
14
|
-
}));
|
|
15
|
-
|
|
14
|
+
fields: t.record(common_1.WidgetKey, t.union([exports.Group, NestableWidget_1.NestableWidget])),
|
|
15
|
+
})));
|
|
16
|
+
const MAX_GROUP_DEPTH = 1;
|
|
17
|
+
const getGroupDepth = (group, depth = 0) => {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
// Stop searching when we're over limit
|
|
20
|
+
if (depth > MAX_GROUP_DEPTH)
|
|
21
|
+
return depth;
|
|
22
|
+
for (const key in (_a = group.config) === null || _a === void 0 ? void 0 : _a.fields) {
|
|
23
|
+
const field = (_b = group.config) === null || _b === void 0 ? void 0 : _b.fields[key];
|
|
24
|
+
if ((field === null || field === void 0 ? void 0 : field.type) === exports.GroupFieldType) {
|
|
25
|
+
depth = Math.max(depth, getGroupDepth(field, depth + 1));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return depth;
|
|
29
|
+
};
|
|
30
|
+
exports.Group = (0, function_1.refineType)(t.recursion("Group", () => t.exact(t.intersection([
|
|
16
31
|
t.type({
|
|
17
32
|
type: t.literal(exports.GroupFieldType),
|
|
18
33
|
}),
|
|
@@ -22,4 +37,9 @@ exports.Group = t.exact(t.intersection([
|
|
|
22
37
|
description: t.string,
|
|
23
38
|
config: exports.GroupConfig,
|
|
24
39
|
}),
|
|
25
|
-
]))
|
|
40
|
+
]))), "Group", (g) => {
|
|
41
|
+
if (getGroupDepth(g) > MAX_GROUP_DEPTH) {
|
|
42
|
+
throw new Error(`Group is nested too deeply (max ${MAX_GROUP_DEPTH} level)`);
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
});
|