@builttocreate/engine-utils 2.3.2-beta.0.2 → 2.3.2-beta.0.4
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 +17 -16
- package/package.json +2 -4
package/dist/fieldHelper.js
CHANGED
|
@@ -283,7 +283,7 @@ var getTemplateWithLookups = function getTemplateWithLookups(template) {
|
|
|
283
283
|
};
|
|
284
284
|
/**
|
|
285
285
|
* This method checks if the field passed via input is empty by checking
|
|
286
|
-
* the field.value
|
|
286
|
+
* the field.value.
|
|
287
287
|
* @param {*} fieldProps
|
|
288
288
|
* @returns
|
|
289
289
|
*/
|
|
@@ -291,31 +291,32 @@ var getTemplateWithLookups = function getTemplateWithLookups(template) {
|
|
|
291
291
|
|
|
292
292
|
exports.getTemplateWithLookups = getTemplateWithLookups;
|
|
293
293
|
|
|
294
|
-
var isFieldEmpty = function isFieldEmpty(
|
|
295
|
-
var type = fieldProps.type,
|
|
296
|
-
value = fieldProps.value,
|
|
297
|
-
options = fieldProps.options;
|
|
294
|
+
var isFieldEmpty = function isFieldEmpty(fieldType, fieldValue, fieldOptions) {
|
|
298
295
|
var isEmpty = false;
|
|
299
296
|
|
|
300
|
-
if (
|
|
297
|
+
if (fieldType === _FieldTypes["default"].block && (!fieldValue || fieldValue && fieldValue.replace(/\s+/g, '').length == 0)) {
|
|
301
298
|
isEmpty = true;
|
|
302
|
-
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (fieldType === _FieldTypes["default"].text && (!fieldValue || fieldValue && fieldValue.replace(/\s+/g, '').length == 0)) {
|
|
302
|
+
isEmpty = true;
|
|
303
|
+
} else if (fieldType === _FieldTypes["default"].text && (!fieldValue || fieldValue && fieldValue.replace(/\s+/g, '').length == 0)) {
|
|
303
304
|
isEmpty = true;
|
|
304
|
-
} else if (
|
|
305
|
+
} else if (fieldType === _FieldTypes["default"].number && !fieldValue) {
|
|
305
306
|
isEmpty = true;
|
|
306
|
-
} else if (
|
|
307
|
+
} else if (fieldType === _FieldTypes["default"].date && !fieldValue) {
|
|
307
308
|
isEmpty = true;
|
|
308
|
-
} else if (
|
|
309
|
+
} else if (fieldType === _FieldTypes["default"].signature && !fieldValue) {
|
|
309
310
|
isEmpty = true;
|
|
310
|
-
} else if (
|
|
311
|
+
} else if (fieldType === _FieldTypes["default"].dropdown && (!fieldValue || fieldValue && fieldOptions.length > 0 && isTargetOptionDeleted(fieldValue, fieldOptions))) {
|
|
311
312
|
isEmpty = true;
|
|
312
|
-
} else if (
|
|
313
|
+
} else if (fieldType === _FieldTypes["default"].multiSelect && (!fieldValue || fieldValue && fieldOptions.length > 0 && isTargetOptionDeleted(fieldValue, fieldOptions))) {
|
|
313
314
|
isEmpty = true;
|
|
314
|
-
} else if (
|
|
315
|
+
} else if (fieldType === _FieldTypes["default"].image && (!fieldValue || fieldValue && fieldValue.length === 0)) {
|
|
315
316
|
isEmpty = true;
|
|
316
|
-
} else if (
|
|
317
|
+
} else if (fieldType === _FieldTypes["default"].chart && (!fieldValue || fieldValue && fieldValue.length === 0)) {
|
|
317
318
|
isEmpty = true;
|
|
318
|
-
} else if (
|
|
319
|
+
} else if (fieldType === _FieldTypes["default"].table && (!fieldValue || fieldValue && fieldValue.filter(function (item) {
|
|
319
320
|
return !item.deleted;
|
|
320
321
|
}).length === 0)) {
|
|
321
322
|
isEmpty = true;
|
|
@@ -326,7 +327,7 @@ var isFieldEmpty = function isFieldEmpty(fieldProps) {
|
|
|
326
327
|
/**
|
|
327
328
|
* This function checks whether an option associated with multiselect or dropdown
|
|
328
329
|
* field is deleted.
|
|
329
|
-
* @param {*} value // value
|
|
330
|
+
* @param {*} value // value
|
|
330
331
|
* @param {*} options
|
|
331
332
|
*/
|
|
332
333
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builttocreate/engine-utils",
|
|
3
|
-
"version": "2.3.2-beta.0.
|
|
3
|
+
"version": "2.3.2-beta.0.4",
|
|
4
4
|
"description": "Utility library for common logic shared across web and mobile",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -54,8 +54,6 @@
|
|
|
54
54
|
"moduleNameMapper": {
|
|
55
55
|
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
|
|
56
56
|
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
|
|
57
|
-
}
|
|
58
|
-
"globalSetup":"./jestConfig.js"
|
|
59
|
-
|
|
57
|
+
}
|
|
60
58
|
}
|
|
61
59
|
}
|