@builttocreate/engine-utils 2.6.1 → 2.7.0-beta.0

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.
@@ -7,7 +7,7 @@ exports["default"] = void 0;
7
7
  // Display Fields
8
8
  var uniqueId = 'uniqueId';
9
9
  var image = 'image';
10
- var fileUpload = 'fileUpload';
10
+ var file = 'file';
11
11
  var richText = 'richText';
12
12
  var block = 'block'; // Data Fields
13
13
 
@@ -27,7 +27,7 @@ var chart = 'chart';
27
27
  var types = {
28
28
  uniqueId: uniqueId,
29
29
  image: image,
30
- fileUpload: fileUpload,
30
+ file: file,
31
31
  block: block,
32
32
  richText: richText,
33
33
  text: text,
@@ -48,7 +48,7 @@ types.all = Object.keys(types);
48
48
  types.titles = {
49
49
  uniqueId: 'Auto Number',
50
50
  image: 'Image',
51
- file: 'FileUpload',
51
+ file: 'File',
52
52
  block: 'Display Text',
53
53
  richText: 'Rich Text',
54
54
  text: 'Short Text',
@@ -130,7 +130,7 @@ exports.handleMultiSelectOptionToggle = handleMultiSelectOptionToggle;
130
130
  var getDefaultFieldValuesFromTemplate = function getDefaultFieldValuesFromTemplate(template, defaultUserId) {
131
131
  var fields = {};
132
132
  template.fields.forEach(function (field) {
133
- if (!field || field.deleted || field.type === _FieldTypes["default"].uniqueId || field.type === _FieldTypes["default"].task || field.type === _FieldTypes["default"].signature || field.type === _FieldTypes["default"].fileUpload || field.type === _FieldTypes["default"].image || field.type === _FieldTypes["default"].richText) {
133
+ if (!field || field.deleted || field.type === _FieldTypes["default"].uniqueId || field.type === _FieldTypes["default"].task || field.type === _FieldTypes["default"].signature || field.type === _FieldTypes["default"].file || field.type === _FieldTypes["default"].image || field.type === _FieldTypes["default"].richText) {
134
134
  return;
135
135
  }
136
136
 
@@ -187,7 +187,7 @@ var getImportFieldValues = function getImportFieldValues(template, importSource,
187
187
 
188
188
  var targetFieldValue = importTarget.fields[field._id];
189
189
 
190
- if (field.deleted || field.blockImport || field.type === _FieldTypes["default"].uniqueId || field.type === _FieldTypes["default"].task || field.type === _FieldTypes["default"].signature || field.type === _FieldTypes["default"].fileUpload || field.type === _FieldTypes["default"].richText || field.type === _FieldTypes["default"].image) {
190
+ if (field.deleted || field.blockImport || field.type === _FieldTypes["default"].uniqueId || field.type === _FieldTypes["default"].task || field.type === _FieldTypes["default"].signature || field.type === _FieldTypes["default"].file || field.type === _FieldTypes["default"].richText || field.type === _FieldTypes["default"].image) {
191
191
  return;
192
192
  } else if ((field.type === _FieldTypes["default"].table || field.type === _FieldTypes["default"].inputGroup) && sourceFieldValue) {
193
193
  var nextTableFieldValues = [];
@@ -310,7 +310,7 @@ var isFieldEmpty = function isFieldEmpty(fieldType, fieldValue, fieldOptions) {
310
310
  isEmpty = true;
311
311
  } else if (fieldType === _FieldTypes["default"].image && (!fieldValue || fieldValue && fieldValue.length === 0)) {
312
312
  isEmpty = true;
313
- } else if (fieldType === _FieldTypes["default"].fileUpload && (!fieldValue || fieldValue && fieldValue.length === 0)) {
313
+ } else if (fieldType === _FieldTypes["default"].file && (!fieldValue || fieldValue && fieldValue.length === 0)) {
314
314
  isEmpty = true;
315
315
  } else if (fieldType === _FieldTypes["default"].chart && (!fieldValue || fieldValue && fieldValue.length === 0)) {
316
316
  isEmpty = true;
@@ -464,6 +464,25 @@ var duplicateDocumentPage = function duplicateDocumentPage(doc, fileId, pageId)
464
464
  var duplicateField = _objectSpread(_objectSpread({}, field), {}, {
465
465
  _id: (0, _generateObjectId["default"])()
466
466
  });
467
+ /**
468
+ * Logic to make the table field blank if clearColumnData is true for the column
469
+ */
470
+
471
+
472
+ if ((duplicateField.type === _FieldTypes["default"].table || duplicateField.type === _FieldTypes["default"].inputGroup) && duplicateField.tableColumns.length > 0 && duplicateField.tableColumns.filter(function (column) {
473
+ return column.clearData;
474
+ }).length > 0) {
475
+ var columnsWithClearData = duplicateField.tableColumns.filter(function (column) {
476
+ return column.clearColumnData;
477
+ });
478
+ var nextFieldValue = JSON.parse(JSON.stringify(duplicateField.value));
479
+ columnsWithClearData.forEach(function (column) {
480
+ nextFieldValue.forEach(function (row) {
481
+ row.cells[column._id] = '';
482
+ });
483
+ });
484
+ duplicateField.value = nextFieldValue;
485
+ }
467
486
 
468
487
  duplicatedFields.push(duplicateField);
469
488
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builttocreate/engine-utils",
3
- "version": "2.6.1",
3
+ "version": "2.7.0-beta.0",
4
4
  "description": "Utility library for common logic shared across web and mobile",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -11,7 +11,7 @@
11
11
  "clean": "rm -rf dist",
12
12
  "build-src": "NODE_ENV=production babel src --out-dir dist --extensions '.js,.jsx' --ignore 'src/testUtils/*','src/**/*.stories.js','src/**/*.test.js','src/lib/**/*.test.js','src/**/__snapshots__','src/**/__mocks__'",
13
13
  "build": "npm run clean && npm run build-src",
14
- "prepublish": "npm run build",
14
+ "prepare": "npm run build",
15
15
  "publish-beta": "npm publish --tag beta",
16
16
  "test": "jest",
17
17
  "test-watch": "jest --watch",