@builttocreate/engine-utils 2.4.0-beta.0.1 → 2.4.0-beta.0.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/dist/fieldHelper.js +10 -7
- package/package.json +1 -1
package/dist/fieldHelper.js
CHANGED
|
@@ -344,14 +344,17 @@ var isFieldEmpty = function isFieldEmpty(fieldType, fieldValue, fieldOptions, fi
|
|
|
344
344
|
exports.isFieldEmpty = isFieldEmpty;
|
|
345
345
|
|
|
346
346
|
var isTargetOptionDeleted = function isTargetOptionDeleted(value, options) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
347
|
+
var nextValue = Array.isArray(value) ? value : [value];
|
|
348
|
+
if (!nextValue || nextValue.length === 0) return true;
|
|
349
|
+
var optionsLookup = {};
|
|
350
|
+
options.forEach(function (option) {
|
|
351
|
+
optionsLookup[option._id] = option;
|
|
352
|
+
});
|
|
353
|
+
var undeletedOptions = value.filter(function (item) {
|
|
354
|
+
return optionsLookup[item] && !optionsLookup[item].deleted;
|
|
353
355
|
});
|
|
354
|
-
|
|
356
|
+
var result = undeletedOptions.length > 0 ? false : true;
|
|
357
|
+
return result;
|
|
355
358
|
};
|
|
356
359
|
|
|
357
360
|
exports.isTargetOptionDeleted = isTargetOptionDeleted;
|