@builttocreate/engine-utils 2.8.0-beta.6 → 2.8.0-beta.8
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/dist/joyDocHelper.js +12 -10
- package/package.json +1 -1
package/dist/joyDocHelper.js
CHANGED
|
@@ -171,7 +171,6 @@ var removeOrphanedFieldsFromJoydoc = exports.removeOrphanedFieldsFromJoydoc = fu
|
|
|
171
171
|
nextDoc.fields = nextDoc.fields.filter(function (field) {
|
|
172
172
|
var isOrphanedField = true;
|
|
173
173
|
nextDoc.files.forEach(function (file) {
|
|
174
|
-
var _file$views$find;
|
|
175
174
|
var primaryViewPages = file.pages;
|
|
176
175
|
|
|
177
176
|
// Check if field is associated with any field positions in primary view pages
|
|
@@ -180,21 +179,24 @@ var removeOrphanedFieldsFromJoydoc = exports.removeOrphanedFieldsFromJoydoc = fu
|
|
|
180
179
|
return fieldPosition.field === field._id;
|
|
181
180
|
});
|
|
182
181
|
});
|
|
183
|
-
var mobileViewPages = file.views.length > 0 ? ((_file$views$find = file.views.find(function (view) {
|
|
184
|
-
return view.type === _FileViews["default"].mobile;
|
|
185
|
-
})) === null || _file$views$find === void 0 ? void 0 : _file$views$find.pages) || [] : null;
|
|
186
182
|
|
|
187
|
-
// Check if field is associated with
|
|
188
|
-
var
|
|
189
|
-
|
|
190
|
-
|
|
183
|
+
// Check if field is associated with other views
|
|
184
|
+
var isFieldAssociatedWithAnotherView;
|
|
185
|
+
if (file.views && file.views.length > 0) {
|
|
186
|
+
isFieldAssociatedWithAnotherView = file.views.some(function (view) {
|
|
187
|
+
return view.pages.some(function (page) {
|
|
188
|
+
return page.fieldPositions.some(function (fieldPosition) {
|
|
189
|
+
return fieldPosition.field === field._id;
|
|
190
|
+
});
|
|
191
|
+
});
|
|
191
192
|
});
|
|
192
|
-
}
|
|
193
|
-
if (isFieldAssociatedWithPrimaryView ||
|
|
193
|
+
}
|
|
194
|
+
if (isFieldAssociatedWithPrimaryView || isFieldAssociatedWithAnotherView) {
|
|
194
195
|
isOrphanedField = false;
|
|
195
196
|
}
|
|
196
197
|
});
|
|
197
198
|
if (!isOrphanedField) return field;
|
|
199
|
+
return null;
|
|
198
200
|
});
|
|
199
201
|
return nextDoc;
|
|
200
202
|
};
|