@prismicio/types-internal 3.9.0 → 3.10.0-alpha.1
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/_internal/utils.d.ts +6 -1
- package/lib/content/Document.d.ts +1 -1
- package/lib/customtypes/CustomType.d.ts +402 -162
- package/lib/customtypes/CustomType.js +16 -1
- package/lib/customtypes/Section.d.ts +403 -162
- package/lib/customtypes/Section.js +40 -1
- package/lib/customtypes/diff/SharedSlice.d.ts +168 -64
- package/lib/customtypes/diff/Variation.d.ts +168 -64
- package/lib/customtypes/widgets/Group.d.ts +258 -90
- package/lib/customtypes/widgets/Group.js +62 -1
- package/lib/customtypes/widgets/Widget.d.ts +621 -231
- package/lib/customtypes/widgets/nestable/Link.d.ts +82 -30
- package/lib/customtypes/widgets/nestable/Link.js +43 -19
- package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +41 -15
- package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +89 -30
- package/lib/customtypes/widgets/slices/CompositeSlice.js +26 -1
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +82 -30
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +341 -120
- package/lib/customtypes/widgets/slices/SharedSlice.js +59 -1
- package/lib/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +186 -69
- package/lib/customtypes/widgets/slices/Slices.d.ts +836 -308
- package/lib/customtypes/widgets/slices/Slices.js +61 -1
- package/package.json +1 -1
- package/src/_internal/utils.ts +4 -0
- package/src/customtypes/CustomType.ts +30 -1
- package/src/customtypes/Section.ts +53 -0
- package/src/customtypes/widgets/Group.ts +75 -0
- package/src/customtypes/widgets/nestable/Link.ts +85 -24
- package/src/customtypes/widgets/slices/CompositeSlice.ts +38 -0
- package/src/customtypes/widgets/slices/SharedSlice.ts +71 -0
- package/src/customtypes/widgets/slices/Slices.ts +69 -2
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
+
import type { OnFieldFn } from "../../_internal/utils";
|
|
3
|
+
import { NestableWidget } from "./nestable/NestableWidget";
|
|
2
4
|
export declare const GroupFieldType = "Group";
|
|
3
5
|
export declare const NestedGroupConfig: t.ExactC<t.PartialC<{
|
|
4
6
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -133,29 +135,55 @@ export declare const NestedGroupConfig: t.ExactC<t.PartialC<{
|
|
|
133
135
|
useAsTitle: t.BooleanC;
|
|
134
136
|
placeholder: t.StringC;
|
|
135
137
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
136
|
-
customtypes: t.Type<readonly (string |
|
|
138
|
+
customtypes: t.Type<readonly (string | {
|
|
137
139
|
id: string;
|
|
138
|
-
|
|
139
|
-
fields?: readonly (string | {
|
|
140
|
+
fields: readonly (string | {
|
|
140
141
|
id: string;
|
|
141
|
-
customtypes: readonly (string |
|
|
142
|
+
customtypes: readonly (string | {
|
|
142
143
|
id: string;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
fields: readonly (string | {
|
|
145
|
+
id: string;
|
|
146
|
+
fields: readonly string[];
|
|
147
|
+
})[];
|
|
148
|
+
})[];
|
|
149
|
+
} | {
|
|
150
|
+
id: string;
|
|
151
|
+
fields: readonly (string | {
|
|
152
|
+
id: string;
|
|
153
|
+
customtypes: readonly (string | {
|
|
154
|
+
id: string;
|
|
155
|
+
fields: readonly (string | {
|
|
156
|
+
id: string;
|
|
157
|
+
fields: readonly string[];
|
|
158
|
+
})[];
|
|
159
|
+
})[];
|
|
160
|
+
})[];
|
|
146
161
|
})[];
|
|
147
|
-
})
|
|
162
|
+
})[], readonly (string | {
|
|
148
163
|
id: string;
|
|
149
|
-
|
|
150
|
-
fields?: readonly (string | {
|
|
164
|
+
fields: readonly (string | {
|
|
151
165
|
id: string;
|
|
152
|
-
customtypes: readonly (string |
|
|
166
|
+
customtypes: readonly (string | {
|
|
153
167
|
id: string;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
168
|
+
fields: readonly (string | {
|
|
169
|
+
id: string;
|
|
170
|
+
fields: readonly string[];
|
|
171
|
+
})[];
|
|
172
|
+
})[];
|
|
173
|
+
} | {
|
|
174
|
+
id: string;
|
|
175
|
+
fields: readonly (string | {
|
|
176
|
+
id: string;
|
|
177
|
+
customtypes: readonly (string | {
|
|
178
|
+
id: string;
|
|
179
|
+
fields: readonly (string | {
|
|
180
|
+
id: string;
|
|
181
|
+
fields: readonly string[];
|
|
182
|
+
})[];
|
|
183
|
+
})[];
|
|
184
|
+
})[];
|
|
157
185
|
})[];
|
|
158
|
-
})
|
|
186
|
+
})[], unknown>;
|
|
159
187
|
masks: t.Type<readonly string[], object, unknown>;
|
|
160
188
|
tags: t.Type<readonly string[], object, unknown>;
|
|
161
189
|
allowTargetBlank: t.BooleanC;
|
|
@@ -332,29 +360,55 @@ export declare const NestedGroup: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
332
360
|
useAsTitle: t.BooleanC;
|
|
333
361
|
placeholder: t.StringC;
|
|
334
362
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
335
|
-
customtypes: t.Type<readonly (string |
|
|
363
|
+
customtypes: t.Type<readonly (string | {
|
|
336
364
|
id: string;
|
|
337
|
-
|
|
338
|
-
|
|
365
|
+
fields: readonly (string | {
|
|
366
|
+
id: string;
|
|
367
|
+
customtypes: readonly (string | {
|
|
368
|
+
id: string;
|
|
369
|
+
fields: readonly (string | {
|
|
370
|
+
id: string;
|
|
371
|
+
fields: readonly string[];
|
|
372
|
+
})[];
|
|
373
|
+
})[];
|
|
374
|
+
} | {
|
|
339
375
|
id: string;
|
|
340
|
-
|
|
376
|
+
fields: readonly (string | {
|
|
341
377
|
id: string;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
378
|
+
customtypes: readonly (string | {
|
|
379
|
+
id: string;
|
|
380
|
+
fields: readonly (string | {
|
|
381
|
+
id: string;
|
|
382
|
+
fields: readonly string[];
|
|
383
|
+
})[];
|
|
384
|
+
})[];
|
|
385
|
+
})[];
|
|
345
386
|
})[];
|
|
346
|
-
})
|
|
387
|
+
})[], readonly (string | {
|
|
347
388
|
id: string;
|
|
348
|
-
|
|
349
|
-
fields?: readonly (string | {
|
|
389
|
+
fields: readonly (string | {
|
|
350
390
|
id: string;
|
|
351
|
-
customtypes: readonly (string |
|
|
391
|
+
customtypes: readonly (string | {
|
|
352
392
|
id: string;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
393
|
+
fields: readonly (string | {
|
|
394
|
+
id: string;
|
|
395
|
+
fields: readonly string[];
|
|
396
|
+
})[];
|
|
397
|
+
})[];
|
|
398
|
+
} | {
|
|
399
|
+
id: string;
|
|
400
|
+
fields: readonly (string | {
|
|
401
|
+
id: string;
|
|
402
|
+
customtypes: readonly (string | {
|
|
403
|
+
id: string;
|
|
404
|
+
fields: readonly (string | {
|
|
405
|
+
id: string;
|
|
406
|
+
fields: readonly string[];
|
|
407
|
+
})[];
|
|
408
|
+
})[];
|
|
409
|
+
})[];
|
|
356
410
|
})[];
|
|
357
|
-
})
|
|
411
|
+
})[], unknown>;
|
|
358
412
|
masks: t.Type<readonly string[], object, unknown>;
|
|
359
413
|
tags: t.Type<readonly string[], object, unknown>;
|
|
360
414
|
allowTargetBlank: t.BooleanC;
|
|
@@ -526,29 +580,55 @@ export declare const GroupConfig: t.ExactC<t.PartialC<{
|
|
|
526
580
|
useAsTitle: t.BooleanC;
|
|
527
581
|
placeholder: t.StringC;
|
|
528
582
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
529
|
-
customtypes: t.Type<readonly (string |
|
|
583
|
+
customtypes: t.Type<readonly (string | {
|
|
530
584
|
id: string;
|
|
531
|
-
|
|
532
|
-
fields?: readonly (string | {
|
|
585
|
+
fields: readonly (string | {
|
|
533
586
|
id: string;
|
|
534
|
-
customtypes: readonly (string |
|
|
587
|
+
customtypes: readonly (string | {
|
|
535
588
|
id: string;
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
589
|
+
fields: readonly (string | {
|
|
590
|
+
id: string;
|
|
591
|
+
fields: readonly string[];
|
|
592
|
+
})[];
|
|
593
|
+
})[];
|
|
594
|
+
} | {
|
|
595
|
+
id: string;
|
|
596
|
+
fields: readonly (string | {
|
|
597
|
+
id: string;
|
|
598
|
+
customtypes: readonly (string | {
|
|
599
|
+
id: string;
|
|
600
|
+
fields: readonly (string | {
|
|
601
|
+
id: string;
|
|
602
|
+
fields: readonly string[];
|
|
603
|
+
})[];
|
|
604
|
+
})[];
|
|
605
|
+
})[];
|
|
539
606
|
})[];
|
|
540
|
-
})
|
|
607
|
+
})[], readonly (string | {
|
|
541
608
|
id: string;
|
|
542
|
-
|
|
543
|
-
|
|
609
|
+
fields: readonly (string | {
|
|
610
|
+
id: string;
|
|
611
|
+
customtypes: readonly (string | {
|
|
612
|
+
id: string;
|
|
613
|
+
fields: readonly (string | {
|
|
614
|
+
id: string;
|
|
615
|
+
fields: readonly string[];
|
|
616
|
+
})[];
|
|
617
|
+
})[];
|
|
618
|
+
} | {
|
|
544
619
|
id: string;
|
|
545
|
-
|
|
620
|
+
fields: readonly (string | {
|
|
546
621
|
id: string;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
622
|
+
customtypes: readonly (string | {
|
|
623
|
+
id: string;
|
|
624
|
+
fields: readonly (string | {
|
|
625
|
+
id: string;
|
|
626
|
+
fields: readonly string[];
|
|
627
|
+
})[];
|
|
628
|
+
})[];
|
|
629
|
+
})[];
|
|
550
630
|
})[];
|
|
551
|
-
})
|
|
631
|
+
})[], unknown>;
|
|
552
632
|
masks: t.Type<readonly string[], object, unknown>;
|
|
553
633
|
tags: t.Type<readonly string[], object, unknown>;
|
|
554
634
|
allowTargetBlank: t.BooleanC;
|
|
@@ -722,29 +802,55 @@ export declare const GroupConfig: t.ExactC<t.PartialC<{
|
|
|
722
802
|
useAsTitle: t.BooleanC;
|
|
723
803
|
placeholder: t.StringC;
|
|
724
804
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
725
|
-
customtypes: t.Type<readonly (string |
|
|
805
|
+
customtypes: t.Type<readonly (string | {
|
|
726
806
|
id: string;
|
|
727
|
-
|
|
728
|
-
fields?: readonly (string | {
|
|
807
|
+
fields: readonly (string | {
|
|
729
808
|
id: string;
|
|
730
|
-
customtypes: readonly (string |
|
|
809
|
+
customtypes: readonly (string | {
|
|
731
810
|
id: string;
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
811
|
+
fields: readonly (string | {
|
|
812
|
+
id: string;
|
|
813
|
+
fields: readonly string[];
|
|
814
|
+
})[];
|
|
815
|
+
})[];
|
|
816
|
+
} | {
|
|
817
|
+
id: string;
|
|
818
|
+
fields: readonly (string | {
|
|
819
|
+
id: string;
|
|
820
|
+
customtypes: readonly (string | {
|
|
821
|
+
id: string;
|
|
822
|
+
fields: readonly (string | {
|
|
823
|
+
id: string;
|
|
824
|
+
fields: readonly string[];
|
|
825
|
+
})[];
|
|
826
|
+
})[];
|
|
827
|
+
})[];
|
|
735
828
|
})[];
|
|
736
|
-
})
|
|
829
|
+
})[], readonly (string | {
|
|
737
830
|
id: string;
|
|
738
|
-
|
|
739
|
-
fields?: readonly (string | {
|
|
831
|
+
fields: readonly (string | {
|
|
740
832
|
id: string;
|
|
741
|
-
customtypes: readonly (string |
|
|
833
|
+
customtypes: readonly (string | {
|
|
742
834
|
id: string;
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
835
|
+
fields: readonly (string | {
|
|
836
|
+
id: string;
|
|
837
|
+
fields: readonly string[];
|
|
838
|
+
})[];
|
|
839
|
+
})[];
|
|
840
|
+
} | {
|
|
841
|
+
id: string;
|
|
842
|
+
fields: readonly (string | {
|
|
843
|
+
id: string;
|
|
844
|
+
customtypes: readonly (string | {
|
|
845
|
+
id: string;
|
|
846
|
+
fields: readonly (string | {
|
|
847
|
+
id: string;
|
|
848
|
+
fields: readonly string[];
|
|
849
|
+
})[];
|
|
850
|
+
})[];
|
|
851
|
+
})[];
|
|
746
852
|
})[];
|
|
747
|
-
})
|
|
853
|
+
})[], unknown>;
|
|
748
854
|
masks: t.Type<readonly string[], object, unknown>;
|
|
749
855
|
tags: t.Type<readonly string[], object, unknown>;
|
|
750
856
|
allowTargetBlank: t.BooleanC;
|
|
@@ -923,29 +1029,55 @@ export declare const Group: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
923
1029
|
useAsTitle: t.BooleanC;
|
|
924
1030
|
placeholder: t.StringC;
|
|
925
1031
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
926
|
-
customtypes: t.Type<readonly (string |
|
|
1032
|
+
customtypes: t.Type<readonly (string | {
|
|
927
1033
|
id: string;
|
|
928
|
-
|
|
929
|
-
|
|
1034
|
+
fields: readonly (string | {
|
|
1035
|
+
id: string;
|
|
1036
|
+
customtypes: readonly (string | {
|
|
1037
|
+
id: string;
|
|
1038
|
+
fields: readonly (string | {
|
|
1039
|
+
id: string;
|
|
1040
|
+
fields: readonly string[];
|
|
1041
|
+
})[];
|
|
1042
|
+
})[];
|
|
1043
|
+
} | {
|
|
930
1044
|
id: string;
|
|
931
|
-
|
|
1045
|
+
fields: readonly (string | {
|
|
932
1046
|
id: string;
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1047
|
+
customtypes: readonly (string | {
|
|
1048
|
+
id: string;
|
|
1049
|
+
fields: readonly (string | {
|
|
1050
|
+
id: string;
|
|
1051
|
+
fields: readonly string[];
|
|
1052
|
+
})[];
|
|
1053
|
+
})[];
|
|
1054
|
+
})[];
|
|
936
1055
|
})[];
|
|
937
|
-
})
|
|
1056
|
+
})[], readonly (string | {
|
|
938
1057
|
id: string;
|
|
939
|
-
|
|
940
|
-
fields?: readonly (string | {
|
|
1058
|
+
fields: readonly (string | {
|
|
941
1059
|
id: string;
|
|
942
|
-
customtypes: readonly (string |
|
|
1060
|
+
customtypes: readonly (string | {
|
|
943
1061
|
id: string;
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1062
|
+
fields: readonly (string | {
|
|
1063
|
+
id: string;
|
|
1064
|
+
fields: readonly string[];
|
|
1065
|
+
})[];
|
|
1066
|
+
})[];
|
|
1067
|
+
} | {
|
|
1068
|
+
id: string;
|
|
1069
|
+
fields: readonly (string | {
|
|
1070
|
+
id: string;
|
|
1071
|
+
customtypes: readonly (string | {
|
|
1072
|
+
id: string;
|
|
1073
|
+
fields: readonly (string | {
|
|
1074
|
+
id: string;
|
|
1075
|
+
fields: readonly string[];
|
|
1076
|
+
})[];
|
|
1077
|
+
})[];
|
|
1078
|
+
})[];
|
|
947
1079
|
})[];
|
|
948
|
-
})
|
|
1080
|
+
})[], unknown>;
|
|
949
1081
|
masks: t.Type<readonly string[], object, unknown>;
|
|
950
1082
|
tags: t.Type<readonly string[], object, unknown>;
|
|
951
1083
|
allowTargetBlank: t.BooleanC;
|
|
@@ -1119,29 +1251,55 @@ export declare const Group: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1119
1251
|
useAsTitle: t.BooleanC;
|
|
1120
1252
|
placeholder: t.StringC;
|
|
1121
1253
|
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
1122
|
-
customtypes: t.Type<readonly (string |
|
|
1254
|
+
customtypes: t.Type<readonly (string | {
|
|
1123
1255
|
id: string;
|
|
1124
|
-
|
|
1125
|
-
|
|
1256
|
+
fields: readonly (string | {
|
|
1257
|
+
id: string;
|
|
1258
|
+
customtypes: readonly (string | {
|
|
1259
|
+
id: string;
|
|
1260
|
+
fields: readonly (string | {
|
|
1261
|
+
id: string;
|
|
1262
|
+
fields: readonly string[];
|
|
1263
|
+
})[];
|
|
1264
|
+
})[];
|
|
1265
|
+
} | {
|
|
1126
1266
|
id: string;
|
|
1127
|
-
|
|
1267
|
+
fields: readonly (string | {
|
|
1128
1268
|
id: string;
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1269
|
+
customtypes: readonly (string | {
|
|
1270
|
+
id: string;
|
|
1271
|
+
fields: readonly (string | {
|
|
1272
|
+
id: string;
|
|
1273
|
+
fields: readonly string[];
|
|
1274
|
+
})[];
|
|
1275
|
+
})[];
|
|
1276
|
+
})[];
|
|
1132
1277
|
})[];
|
|
1133
|
-
})
|
|
1278
|
+
})[], readonly (string | {
|
|
1134
1279
|
id: string;
|
|
1135
|
-
|
|
1136
|
-
|
|
1280
|
+
fields: readonly (string | {
|
|
1281
|
+
id: string;
|
|
1282
|
+
customtypes: readonly (string | {
|
|
1283
|
+
id: string;
|
|
1284
|
+
fields: readonly (string | {
|
|
1285
|
+
id: string;
|
|
1286
|
+
fields: readonly string[];
|
|
1287
|
+
})[];
|
|
1288
|
+
})[];
|
|
1289
|
+
} | {
|
|
1137
1290
|
id: string;
|
|
1138
|
-
|
|
1291
|
+
fields: readonly (string | {
|
|
1139
1292
|
id: string;
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1293
|
+
customtypes: readonly (string | {
|
|
1294
|
+
id: string;
|
|
1295
|
+
fields: readonly (string | {
|
|
1296
|
+
id: string;
|
|
1297
|
+
fields: readonly string[];
|
|
1298
|
+
})[];
|
|
1299
|
+
})[];
|
|
1300
|
+
})[];
|
|
1143
1301
|
})[];
|
|
1144
|
-
})
|
|
1302
|
+
})[], unknown>;
|
|
1145
1303
|
masks: t.Type<readonly string[], object, unknown>;
|
|
1146
1304
|
tags: t.Type<readonly string[], object, unknown>;
|
|
1147
1305
|
allowTargetBlank: t.BooleanC;
|
|
@@ -1182,3 +1340,13 @@ export declare const Group: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1182
1340
|
}>>;
|
|
1183
1341
|
}>]>>;
|
|
1184
1342
|
export declare type Group = t.TypeOf<typeof Group>;
|
|
1343
|
+
export declare function traverseNestedGroup(args: {
|
|
1344
|
+
path: ReadonlyArray<string>;
|
|
1345
|
+
group: NestedGroup;
|
|
1346
|
+
onField: OnFieldFn<NestableWidget>;
|
|
1347
|
+
}): NestedGroup;
|
|
1348
|
+
export declare function traverseGroup(args: {
|
|
1349
|
+
path: ReadonlyArray<string>;
|
|
1350
|
+
group: Group;
|
|
1351
|
+
onField: OnFieldFn<NestableWidget | NestedGroup>;
|
|
1352
|
+
}): Group;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Group = exports.GroupConfig = exports.NestedGroup = exports.NestedGroupConfig = exports.GroupFieldType = void 0;
|
|
3
|
+
exports.traverseGroup = exports.traverseNestedGroup = exports.Group = exports.GroupConfig = exports.NestedGroup = exports.NestedGroupConfig = exports.GroupFieldType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const common_1 = require("../../common");
|
|
@@ -31,3 +31,64 @@ exports.NestedGroupConfig = createGroupConfig(NestableWidget_1.NestableWidget);
|
|
|
31
31
|
exports.NestedGroup = createGroup(NestableWidget_1.NestableWidget);
|
|
32
32
|
exports.GroupConfig = createGroupConfig(t.union([NestableWidget_1.NestableWidget, exports.NestedGroup]));
|
|
33
33
|
exports.Group = createGroup(t.union([NestableWidget_1.NestableWidget, exports.NestedGroup]));
|
|
34
|
+
function traverseNestedGroup(args) {
|
|
35
|
+
var _a;
|
|
36
|
+
const { path: prevPath, group, onField } = args;
|
|
37
|
+
const fields = ((_a = group.config) === null || _a === void 0 ? void 0 : _a.fields) &&
|
|
38
|
+
Object.entries(group.config.fields).reduce((acc, [key, model]) => {
|
|
39
|
+
const path = prevPath.concat(key);
|
|
40
|
+
acc[key] = onField({
|
|
41
|
+
path,
|
|
42
|
+
key,
|
|
43
|
+
field: model,
|
|
44
|
+
});
|
|
45
|
+
return acc;
|
|
46
|
+
}, {});
|
|
47
|
+
return {
|
|
48
|
+
...group,
|
|
49
|
+
...(group.config && {
|
|
50
|
+
config: {
|
|
51
|
+
...group.config,
|
|
52
|
+
...(fields && { fields }),
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.traverseNestedGroup = traverseNestedGroup;
|
|
58
|
+
function traverseGroup(args) {
|
|
59
|
+
var _a;
|
|
60
|
+
const { path: prevPath, group, onField } = args;
|
|
61
|
+
const fields = ((_a = group.config) === null || _a === void 0 ? void 0 : _a.fields) &&
|
|
62
|
+
Object.entries(group.config.fields).reduce((acc, [key, prevField]) => {
|
|
63
|
+
const path = prevPath.concat(key);
|
|
64
|
+
let field;
|
|
65
|
+
switch (prevField.type) {
|
|
66
|
+
case "Group":
|
|
67
|
+
field = traverseNestedGroup({
|
|
68
|
+
path,
|
|
69
|
+
group: prevField,
|
|
70
|
+
onField: onField,
|
|
71
|
+
});
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
field = prevField;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
acc[key] = onField({
|
|
78
|
+
path,
|
|
79
|
+
key,
|
|
80
|
+
field,
|
|
81
|
+
});
|
|
82
|
+
return acc;
|
|
83
|
+
}, {});
|
|
84
|
+
return {
|
|
85
|
+
...group,
|
|
86
|
+
...(group.config && {
|
|
87
|
+
config: {
|
|
88
|
+
...group.config,
|
|
89
|
+
...(fields && { fields }),
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
exports.traverseGroup = traverseGroup;
|