@fibery/views 1.1.9 → 1.1.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/lib/views.js +34 -10
- package/package.json +1 -1
package/lib/views.js
CHANGED
|
@@ -627,11 +627,14 @@ const replaceNamesWithIdsInFormView = (schema, view) => {
|
|
|
627
627
|
const typeObject = schema.typeObjectsByName.hasOwnProperty(typeId) ? schema.typeObjectsByName[typeId] : null;
|
|
628
628
|
const fields = (_view$fiberyMeta2 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta2.fields;
|
|
629
629
|
const fieldsInIdsTerms = fields && fields.map(field => {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
630
|
+
if (!(typeObject != null && typeObject.fieldObjectsByName.hasOwnProperty(field.id))) {
|
|
631
|
+
return field;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
return _extends({}, field, {
|
|
635
|
+
id: typeObject.fieldObjectsByName[field.id].id
|
|
636
|
+
});
|
|
637
|
+
});
|
|
635
638
|
return _extends({}, view, {
|
|
636
639
|
"fibery/meta": _extends({}, view["fibery/meta"], {
|
|
637
640
|
typeId: typeObject ? typeObject.id : typeId,
|
|
@@ -646,11 +649,14 @@ const replaceIdsWithNamesInFormView = (schema, view) => {
|
|
|
646
649
|
const typeObject = schema.typeObjectsById.hasOwnProperty(typeId) ? schema.typeObjectsById[typeId] : null;
|
|
647
650
|
const fields = (_view$fiberyMeta4 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta4.fields;
|
|
648
651
|
const fieldsInNameTerms = fields && fields.map(field => {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
652
|
+
if (!(typeObject != null && typeObject.fieldObjectsById.hasOwnProperty(field.id))) {
|
|
653
|
+
return field;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
return _extends({}, field, {
|
|
657
|
+
id: typeObject.fieldObjectsById[field.id].name
|
|
658
|
+
});
|
|
659
|
+
});
|
|
654
660
|
return _extends({}, view, {
|
|
655
661
|
"fibery/meta": _extends({}, view["fibery/meta"], {
|
|
656
662
|
typeId: typeObject ? typeObject.name : typeId,
|
|
@@ -658,6 +664,21 @@ const replaceIdsWithNamesInFormView = (schema, view) => {
|
|
|
658
664
|
})
|
|
659
665
|
});
|
|
660
666
|
};
|
|
667
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInFormView = (schema, view) => {
|
|
668
|
+
var _view$fiberyMeta5, _view$fiberyMeta6;
|
|
669
|
+
|
|
670
|
+
// we expect view in names terms here.
|
|
671
|
+
const typeName = (_view$fiberyMeta5 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta5.typeId;
|
|
672
|
+
const typeObject = schema.typeObjectsByName.hasOwnProperty(typeName) ? schema.typeObjectsByName[typeName] : null;
|
|
673
|
+
const fields = (_view$fiberyMeta6 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta6.fields;
|
|
674
|
+
const existingFields = fields && fields.filter(field => typeObject == null ? void 0 : typeObject.fieldObjectsByName.hasOwnProperty(field.id));
|
|
675
|
+
return _extends({}, view, {
|
|
676
|
+
"fibery/meta": _extends({}, view["fibery/meta"], {
|
|
677
|
+
typeId: typeObject ? typeObject.name : typeName,
|
|
678
|
+
fields: existingFields || fields
|
|
679
|
+
})
|
|
680
|
+
});
|
|
681
|
+
};
|
|
661
682
|
|
|
662
683
|
const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["default"](smartFolder, {
|
|
663
684
|
"fibery/meta": {
|
|
@@ -1056,6 +1077,9 @@ const deleteExpressionWithNotFoundFieldsOrTypesInView = (schema, view, ensureAxi
|
|
|
1056
1077
|
case "feed":
|
|
1057
1078
|
return deleteExpressionWithNotFoundFieldsOrTypesInFeedView(schema, view);
|
|
1058
1079
|
|
|
1080
|
+
case "form":
|
|
1081
|
+
return deleteExpressionWithNotFoundFieldsOrTypesInFormView(schema, view);
|
|
1082
|
+
|
|
1059
1083
|
default:
|
|
1060
1084
|
return view;
|
|
1061
1085
|
}
|