slice-machine-ui 2.16.2-alpha.jp-cr-ui-fix-invalid-fields-checked.8 → 2.16.2-alpha.jp-cr-ui-fix-invalid-fields-checked.10
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/out/404.html +1 -1
- package/out/_next/static/{FVeV0wwKKU_9DxItHcHpr → MkhVqkJrIrDEIBAwuuZS4}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/630-e53690702c17b243.js +1 -0
- package/out/_next/static/chunks/pages/{_app-384faec38998f8fa.js → _app-856e0f3f647b7ee9.js} +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/src/features/builder/fields/contentRelationship/ContentRelationshipFieldPicker.tsx +31 -29
- package/src/features/builder/fields/contentRelationship/__tests__/ContentRelationshipFieldPicker.test.ts +232 -183
- package/out/_next/static/chunks/630-5f6022707c0a7d38.js +0 -1
- /package/out/_next/static/{FVeV0wwKKU_9DxItHcHpr → MkhVqkJrIrDEIBAwuuZS4}/_ssgManifest.js +0 -0
|
@@ -515,153 +515,6 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
515
515
|
});
|
|
516
516
|
});
|
|
517
517
|
|
|
518
|
-
it("should not include non-existing/invalid referenced fields", () => {
|
|
519
|
-
const customType2: CustomType = {
|
|
520
|
-
id: "customType2",
|
|
521
|
-
label: "Custom Type 2",
|
|
522
|
-
repeatable: false,
|
|
523
|
-
status: true,
|
|
524
|
-
json: {
|
|
525
|
-
Main: {
|
|
526
|
-
booleanField: {
|
|
527
|
-
type: "Boolean",
|
|
528
|
-
},
|
|
529
|
-
},
|
|
530
|
-
},
|
|
531
|
-
};
|
|
532
|
-
|
|
533
|
-
const customType: CustomType = {
|
|
534
|
-
id: "customType",
|
|
535
|
-
label: "Custom Type",
|
|
536
|
-
repeatable: false,
|
|
537
|
-
status: true,
|
|
538
|
-
json: {
|
|
539
|
-
Main: {
|
|
540
|
-
mdField: {
|
|
541
|
-
type: "StructuredText",
|
|
542
|
-
},
|
|
543
|
-
crField: {
|
|
544
|
-
type: "Link",
|
|
545
|
-
config: {
|
|
546
|
-
select: "document",
|
|
547
|
-
customtypes: ["customType2"],
|
|
548
|
-
},
|
|
549
|
-
},
|
|
550
|
-
groupField: {
|
|
551
|
-
type: "Group",
|
|
552
|
-
config: {
|
|
553
|
-
fields: {
|
|
554
|
-
groupFieldA: {
|
|
555
|
-
type: "Boolean",
|
|
556
|
-
},
|
|
557
|
-
},
|
|
558
|
-
},
|
|
559
|
-
},
|
|
560
|
-
},
|
|
561
|
-
},
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
const result = convertLinkCustomtypesToFieldCheckMap({
|
|
565
|
-
linkCustomtypes: [
|
|
566
|
-
{
|
|
567
|
-
id: "customType",
|
|
568
|
-
fields: [
|
|
569
|
-
"mdField",
|
|
570
|
-
"nonExistingField",
|
|
571
|
-
{
|
|
572
|
-
id: "nonExistingGroup",
|
|
573
|
-
fields: ["groupFieldA"],
|
|
574
|
-
},
|
|
575
|
-
{
|
|
576
|
-
id: "crField",
|
|
577
|
-
customtypes: [
|
|
578
|
-
{
|
|
579
|
-
id: "customType2",
|
|
580
|
-
fields: ["nonExistingNestedField"],
|
|
581
|
-
},
|
|
582
|
-
],
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
id: "groupField",
|
|
586
|
-
fields: ["nonExistingGroupField"],
|
|
587
|
-
},
|
|
588
|
-
],
|
|
589
|
-
},
|
|
590
|
-
],
|
|
591
|
-
allCustomTypes: [customType, customType2],
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
expect(result).toEqual({
|
|
595
|
-
customType: {
|
|
596
|
-
mdField: {
|
|
597
|
-
type: "checkbox",
|
|
598
|
-
value: true,
|
|
599
|
-
},
|
|
600
|
-
},
|
|
601
|
-
});
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
it("should not include an invalid field (uid, slices & choice)", () => {
|
|
605
|
-
const customType: CustomType = {
|
|
606
|
-
id: "customType",
|
|
607
|
-
label: "Custom Type",
|
|
608
|
-
repeatable: false,
|
|
609
|
-
status: true,
|
|
610
|
-
json: {
|
|
611
|
-
Main: {
|
|
612
|
-
booleanField: {
|
|
613
|
-
type: "Boolean",
|
|
614
|
-
},
|
|
615
|
-
typeUid: {
|
|
616
|
-
type: "UID",
|
|
617
|
-
},
|
|
618
|
-
uid: {
|
|
619
|
-
type: "Boolean",
|
|
620
|
-
},
|
|
621
|
-
choice: {
|
|
622
|
-
type: "Choice",
|
|
623
|
-
config: {
|
|
624
|
-
choices: {
|
|
625
|
-
choice1: {
|
|
626
|
-
type: "Boolean",
|
|
627
|
-
},
|
|
628
|
-
},
|
|
629
|
-
},
|
|
630
|
-
},
|
|
631
|
-
slices: {
|
|
632
|
-
type: "Slices",
|
|
633
|
-
config: {
|
|
634
|
-
choices: {
|
|
635
|
-
slice1: {
|
|
636
|
-
type: "SharedSlice",
|
|
637
|
-
},
|
|
638
|
-
},
|
|
639
|
-
},
|
|
640
|
-
},
|
|
641
|
-
},
|
|
642
|
-
},
|
|
643
|
-
};
|
|
644
|
-
|
|
645
|
-
const result = convertLinkCustomtypesToFieldCheckMap({
|
|
646
|
-
linkCustomtypes: [
|
|
647
|
-
{
|
|
648
|
-
id: "customType",
|
|
649
|
-
fields: ["booleanField", "typeUid", "uid", "choice", "slices"],
|
|
650
|
-
},
|
|
651
|
-
],
|
|
652
|
-
allCustomTypes: [customType],
|
|
653
|
-
});
|
|
654
|
-
|
|
655
|
-
expect(result).toEqual({
|
|
656
|
-
customType: {
|
|
657
|
-
booleanField: {
|
|
658
|
-
type: "checkbox",
|
|
659
|
-
value: true,
|
|
660
|
-
},
|
|
661
|
-
},
|
|
662
|
-
});
|
|
663
|
-
});
|
|
664
|
-
|
|
665
518
|
it("should include a correctly referenced group field", () => {
|
|
666
519
|
const customType: CustomType = {
|
|
667
520
|
id: "customType",
|
|
@@ -878,7 +731,154 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
878
731
|
});
|
|
879
732
|
});
|
|
880
733
|
|
|
881
|
-
it("should
|
|
734
|
+
it("should discard non-existing/invalid referenced fields", () => {
|
|
735
|
+
const customType2: CustomType = {
|
|
736
|
+
id: "customType2",
|
|
737
|
+
label: "Custom Type 2",
|
|
738
|
+
repeatable: false,
|
|
739
|
+
status: true,
|
|
740
|
+
json: {
|
|
741
|
+
Main: {
|
|
742
|
+
booleanField: {
|
|
743
|
+
type: "Boolean",
|
|
744
|
+
},
|
|
745
|
+
},
|
|
746
|
+
},
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
const customType: CustomType = {
|
|
750
|
+
id: "customType",
|
|
751
|
+
label: "Custom Type",
|
|
752
|
+
repeatable: false,
|
|
753
|
+
status: true,
|
|
754
|
+
json: {
|
|
755
|
+
Main: {
|
|
756
|
+
mdField: {
|
|
757
|
+
type: "StructuredText",
|
|
758
|
+
},
|
|
759
|
+
crField: {
|
|
760
|
+
type: "Link",
|
|
761
|
+
config: {
|
|
762
|
+
select: "document",
|
|
763
|
+
customtypes: ["customType2"],
|
|
764
|
+
},
|
|
765
|
+
},
|
|
766
|
+
groupField: {
|
|
767
|
+
type: "Group",
|
|
768
|
+
config: {
|
|
769
|
+
fields: {
|
|
770
|
+
groupFieldA: {
|
|
771
|
+
type: "Boolean",
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
},
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
const result = convertLinkCustomtypesToFieldCheckMap({
|
|
781
|
+
linkCustomtypes: [
|
|
782
|
+
{
|
|
783
|
+
id: "customType",
|
|
784
|
+
fields: [
|
|
785
|
+
"mdField",
|
|
786
|
+
"nonExistingField",
|
|
787
|
+
{
|
|
788
|
+
id: "nonExistingGroup",
|
|
789
|
+
fields: ["groupFieldA"],
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
id: "crField",
|
|
793
|
+
customtypes: [
|
|
794
|
+
{
|
|
795
|
+
id: "customType2",
|
|
796
|
+
fields: ["nonExistingNestedField"],
|
|
797
|
+
},
|
|
798
|
+
],
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
id: "groupField",
|
|
802
|
+
fields: ["nonExistingGroupField"],
|
|
803
|
+
},
|
|
804
|
+
],
|
|
805
|
+
},
|
|
806
|
+
],
|
|
807
|
+
allCustomTypes: [customType, customType2],
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
expect(result).toEqual({
|
|
811
|
+
customType: {
|
|
812
|
+
mdField: {
|
|
813
|
+
type: "checkbox",
|
|
814
|
+
value: true,
|
|
815
|
+
},
|
|
816
|
+
},
|
|
817
|
+
});
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
it("should discard invalid fields (uid, slices & choice)", () => {
|
|
821
|
+
const customType: CustomType = {
|
|
822
|
+
id: "customType",
|
|
823
|
+
label: "Custom Type",
|
|
824
|
+
repeatable: false,
|
|
825
|
+
status: true,
|
|
826
|
+
json: {
|
|
827
|
+
Main: {
|
|
828
|
+
booleanField: {
|
|
829
|
+
type: "Boolean",
|
|
830
|
+
},
|
|
831
|
+
typeUid: {
|
|
832
|
+
type: "UID",
|
|
833
|
+
},
|
|
834
|
+
uid: {
|
|
835
|
+
type: "Boolean",
|
|
836
|
+
},
|
|
837
|
+
choice: {
|
|
838
|
+
type: "Choice",
|
|
839
|
+
config: {
|
|
840
|
+
choices: {
|
|
841
|
+
choice1: {
|
|
842
|
+
type: "Boolean",
|
|
843
|
+
},
|
|
844
|
+
},
|
|
845
|
+
},
|
|
846
|
+
},
|
|
847
|
+
slices: {
|
|
848
|
+
type: "Slices",
|
|
849
|
+
config: {
|
|
850
|
+
choices: {
|
|
851
|
+
slice1: {
|
|
852
|
+
type: "SharedSlice",
|
|
853
|
+
},
|
|
854
|
+
},
|
|
855
|
+
},
|
|
856
|
+
},
|
|
857
|
+
},
|
|
858
|
+
},
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
const result = convertLinkCustomtypesToFieldCheckMap({
|
|
862
|
+
linkCustomtypes: [
|
|
863
|
+
{
|
|
864
|
+
id: "customType",
|
|
865
|
+
fields: ["booleanField", "typeUid", "uid", "choice", "slices"],
|
|
866
|
+
},
|
|
867
|
+
],
|
|
868
|
+
allCustomTypes: [customType],
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
expect(result).toEqual({
|
|
872
|
+
customType: {
|
|
873
|
+
booleanField: {
|
|
874
|
+
type: "checkbox",
|
|
875
|
+
value: true,
|
|
876
|
+
},
|
|
877
|
+
},
|
|
878
|
+
});
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
it("should discard a regular field referenced as a group field", () => {
|
|
882
882
|
const customType: CustomType = {
|
|
883
883
|
id: "customType",
|
|
884
884
|
label: "Custom Type",
|
|
@@ -900,7 +900,7 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
900
900
|
fields: [
|
|
901
901
|
{
|
|
902
902
|
id: "booleanField",
|
|
903
|
-
fields: ["
|
|
903
|
+
fields: ["something"],
|
|
904
904
|
},
|
|
905
905
|
],
|
|
906
906
|
},
|
|
@@ -911,7 +911,40 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
911
911
|
expect(result).toEqual({});
|
|
912
912
|
});
|
|
913
913
|
|
|
914
|
-
it("should
|
|
914
|
+
it("should discard a regular field referenced as a content relationship field", () => {
|
|
915
|
+
const customType: CustomType = {
|
|
916
|
+
id: "customType",
|
|
917
|
+
label: "Custom Type",
|
|
918
|
+
repeatable: false,
|
|
919
|
+
status: true,
|
|
920
|
+
json: {
|
|
921
|
+
Main: {
|
|
922
|
+
booleanField: {
|
|
923
|
+
type: "Boolean",
|
|
924
|
+
},
|
|
925
|
+
},
|
|
926
|
+
},
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
const result = convertLinkCustomtypesToFieldCheckMap({
|
|
930
|
+
linkCustomtypes: [
|
|
931
|
+
{
|
|
932
|
+
id: "customType",
|
|
933
|
+
fields: [
|
|
934
|
+
{
|
|
935
|
+
id: "booleanField",
|
|
936
|
+
customtypes: [],
|
|
937
|
+
},
|
|
938
|
+
],
|
|
939
|
+
},
|
|
940
|
+
],
|
|
941
|
+
allCustomTypes: [customType],
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
expect(result).toEqual({});
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
it("should discard a group field referenced as a regular field (string/no picked fields)", () => {
|
|
915
948
|
const customType: CustomType = {
|
|
916
949
|
id: "customType",
|
|
917
950
|
label: "Custom Type",
|
|
@@ -984,7 +1017,7 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
984
1017
|
expect(result).toEqual({});
|
|
985
1018
|
});
|
|
986
1019
|
|
|
987
|
-
it("should
|
|
1020
|
+
it("should discard a content relationship field reference to a regular field", () => {
|
|
988
1021
|
const customTypeA: CustomType = {
|
|
989
1022
|
id: "customTypeA",
|
|
990
1023
|
label: "Custom Type A",
|
|
@@ -1035,7 +1068,7 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
1035
1068
|
expect(result).toEqual({});
|
|
1036
1069
|
});
|
|
1037
1070
|
|
|
1038
|
-
it("should
|
|
1071
|
+
it("should discard a content relationship field if it references a non existing custom type", () => {
|
|
1039
1072
|
const customTypeWithField: CustomType = {
|
|
1040
1073
|
id: "customTypeWithField",
|
|
1041
1074
|
label: "Custom Type With Field",
|
|
@@ -1121,10 +1154,10 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
1121
1154
|
expect(result).toEqual({});
|
|
1122
1155
|
});
|
|
1123
1156
|
|
|
1124
|
-
it("should
|
|
1125
|
-
const
|
|
1126
|
-
id: "
|
|
1127
|
-
label: "Custom Type",
|
|
1157
|
+
it("should discard content relationship fields referenced at a depth above 2", () => {
|
|
1158
|
+
const thirdCustomType: CustomType = {
|
|
1159
|
+
id: "thirdCustomType",
|
|
1160
|
+
label: "Third Custom Type",
|
|
1128
1161
|
repeatable: false,
|
|
1129
1162
|
status: true,
|
|
1130
1163
|
json: {
|
|
@@ -1135,35 +1168,36 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
1135
1168
|
},
|
|
1136
1169
|
},
|
|
1137
1170
|
};
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1171
|
+
const secondCustomType: CustomType = {
|
|
1172
|
+
id: "secondCustomType",
|
|
1173
|
+
label: "Second Custom Type",
|
|
1174
|
+
repeatable: false,
|
|
1175
|
+
status: true,
|
|
1176
|
+
json: {
|
|
1177
|
+
Main: {
|
|
1178
|
+
secondCr: {
|
|
1179
|
+
type: "Link",
|
|
1180
|
+
config: {
|
|
1181
|
+
select: "document",
|
|
1182
|
+
customtypes: ["customType2"],
|
|
1147
1183
|
},
|
|
1148
|
-
|
|
1184
|
+
},
|
|
1149
1185
|
},
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
});
|
|
1156
|
-
|
|
1157
|
-
it("should not include a regular field referenced as a group field", () => {
|
|
1158
|
-
const customType: CustomType = {
|
|
1159
|
-
id: "customType",
|
|
1160
|
-
label: "Custom Type",
|
|
1186
|
+
},
|
|
1187
|
+
};
|
|
1188
|
+
const firstCustomType: CustomType = {
|
|
1189
|
+
id: "firstCustomType",
|
|
1190
|
+
label: "First Custom Type",
|
|
1161
1191
|
repeatable: false,
|
|
1162
1192
|
status: true,
|
|
1163
1193
|
json: {
|
|
1164
1194
|
Main: {
|
|
1165
|
-
|
|
1166
|
-
type: "
|
|
1195
|
+
firstCr: {
|
|
1196
|
+
type: "Link",
|
|
1197
|
+
config: {
|
|
1198
|
+
select: "document",
|
|
1199
|
+
customtypes: ["customType"],
|
|
1200
|
+
},
|
|
1167
1201
|
},
|
|
1168
1202
|
},
|
|
1169
1203
|
},
|
|
@@ -1172,16 +1206,31 @@ describe("ContentRelationshipFieldPicker", () => {
|
|
|
1172
1206
|
const result = convertLinkCustomtypesToFieldCheckMap({
|
|
1173
1207
|
linkCustomtypes: [
|
|
1174
1208
|
{
|
|
1175
|
-
id: "
|
|
1209
|
+
id: "firstCustomType",
|
|
1176
1210
|
fields: [
|
|
1177
1211
|
{
|
|
1178
|
-
id: "
|
|
1179
|
-
|
|
1212
|
+
id: "firstCr",
|
|
1213
|
+
customtypes: [
|
|
1214
|
+
{
|
|
1215
|
+
id: "secondCustomType",
|
|
1216
|
+
fields: [
|
|
1217
|
+
{
|
|
1218
|
+
id: "secondCr",
|
|
1219
|
+
// @ts-expect-error - this is a test
|
|
1220
|
+
customtypes: [
|
|
1221
|
+
{
|
|
1222
|
+
id: "thirdCustomType",
|
|
1223
|
+
},
|
|
1224
|
+
],
|
|
1225
|
+
},
|
|
1226
|
+
],
|
|
1227
|
+
},
|
|
1228
|
+
],
|
|
1180
1229
|
},
|
|
1181
1230
|
],
|
|
1182
1231
|
},
|
|
1183
1232
|
],
|
|
1184
|
-
allCustomTypes: [
|
|
1233
|
+
allCustomTypes: [secondCustomType, thirdCustomType, firstCustomType],
|
|
1185
1234
|
});
|
|
1186
1235
|
|
|
1187
1236
|
expect(result).toEqual({});
|