@builttocreate/engine-utils 1.7.0 → 1.7.1-rc.1.1.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.
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.getFormattedActivity = void 0;
8
+ exports["default"] = exports.addDocumentDataToDeficiencyActivities = exports.getFormattedActivity = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
@@ -67,6 +67,23 @@ var getFormattedActivity = function getFormattedActivity(comments, deficiencies,
67
67
  };
68
68
 
69
69
  exports.getFormattedActivity = getFormattedActivity;
70
+
71
+ var addDocumentDataToDeficiencyActivities = function addDocumentDataToDeficiencyActivities(activities, doc, template) {
72
+ if (activities && activities.length > 0 && doc.fields.length > 0 && template.fields.length > 0) {
73
+ var templateFieldLookup = {};
74
+ template.fields.forEach(function (field) {
75
+ return templateFieldLookup[field._id] = field;
76
+ });
77
+ activities.forEach(function (activity) {
78
+ if (activity.type === _ActivityTypes["default"].deficiency && activity.document._id && activity.document.field) {
79
+ activity.document.templateField = templateFieldLookup[activity.document.field];
80
+ activity.document.fieldData = doc.fields[activity.document.field];
81
+ }
82
+ });
83
+ }
84
+ };
85
+
86
+ exports.addDocumentDataToDeficiencyActivities = addDocumentDataToDeficiencyActivities;
70
87
  var _default = {
71
88
  getFormattedActivity: getFormattedActivity
72
89
  };
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getGroupedFilesByType = void 0;
8
+ exports["default"] = exports.getGroupedFilesByType = void 0;
9
9
 
10
10
  var _FileTypes = _interopRequireDefault(require("./constants/FileTypes"));
11
11
 
@@ -27,4 +27,8 @@ var getGroupedFilesByType = function getGroupedFilesByType(files) {
27
27
  };
28
28
  };
29
29
 
30
- exports.getGroupedFilesByType = getGroupedFilesByType;
30
+ exports.getGroupedFilesByType = getGroupedFilesByType;
31
+ var _default = {
32
+ getGroupedFilesByType: getGroupedFilesByType
33
+ };
34
+ exports["default"] = _default;
@@ -90,6 +90,14 @@ exports.sortRows = sortRows;
90
90
 
91
91
  var getFilteredRowOrder = function getFilteredRowOrder(rowOrder, rows, filters) {
92
92
  var filteredColumnIds = filters ? Object.keys(filters) : [];
93
+ var validRowOrder = rowOrder;
94
+
95
+ if (!validRowOrder) {
96
+ var validRows = rows ? getRows(rows) : [];
97
+ validRowOrder = validRows.map(function (row) {
98
+ return row._id;
99
+ });
100
+ }
93
101
 
94
102
  if (filteredColumnIds.length > 0) {
95
103
  var matchedRows = {};
@@ -103,11 +111,11 @@ var getFilteredRowOrder = function getFilteredRowOrder(rowOrder, rows, filters)
103
111
  });
104
112
  if (rowMatched) matchedRows[row._id] = true;
105
113
  });
106
- return rowOrder.filter(function (rowId) {
114
+ return validRowOrder.filter(function (rowId) {
107
115
  return matchedRows[rowId];
108
116
  });
109
117
  } else {
110
- return rowOrder;
118
+ return validRowOrder;
111
119
  }
112
120
  };
113
121
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builttocreate/engine-utils",
3
- "version": "1.7.0",
3
+ "version": "1.7.1-rc.1.1.0",
4
4
  "description": "Utility library for common logic shared across web and mobile",
5
5
  "main": "dist/index.js",
6
6
  "files": [