@builttocreate/engine-utils 1.9.1 → 1.9.3-rc.1.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/activityHelper.js +1 -1
- package/dist/tableHelper.js +19 -6
- package/package.json +2 -1
package/dist/activityHelper.js
CHANGED
|
@@ -94,7 +94,7 @@ var addDocumentDataToActivities = function addDocumentDataToActivities(activitie
|
|
|
94
94
|
activities.forEach(function (activity) {
|
|
95
95
|
var nextActivity = _objectSpread({}, activity);
|
|
96
96
|
|
|
97
|
-
if (activity.document && activity.document.
|
|
97
|
+
if (activity.document && activity.document.field) {
|
|
98
98
|
var docFieldValue = fieldValues[activity.document.field];
|
|
99
99
|
var templateField = templateFieldLookup[activity.document.field];
|
|
100
100
|
nextActivity.document.title = templateField.title;
|
package/dist/tableHelper.js
CHANGED
|
@@ -15,6 +15,8 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
15
15
|
|
|
16
16
|
var _shortid = _interopRequireDefault(require("shortid"));
|
|
17
17
|
|
|
18
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
19
|
+
|
|
18
20
|
var _hotFormulaParser = require("@builttocreate/hot-formula-parser");
|
|
19
21
|
|
|
20
22
|
var _Table = _interopRequireWildcard(require("./constants/Table"));
|
|
@@ -39,7 +41,7 @@ exports.getTableFieldLookupKey = getTableFieldLookupKey;
|
|
|
39
41
|
|
|
40
42
|
var getDefaultRow = function getDefaultRow() {
|
|
41
43
|
return {
|
|
42
|
-
_id: _shortid["default"].generate(),
|
|
44
|
+
_id: "".concat(_shortid["default"].generate()).concat((0, _moment["default"])().valueOf()),
|
|
43
45
|
deleted: false,
|
|
44
46
|
cells: {}
|
|
45
47
|
};
|
|
@@ -98,6 +100,17 @@ var getFilteredRowOrder = function getFilteredRowOrder(rowOrder, rows, filters)
|
|
|
98
100
|
return row._id;
|
|
99
101
|
});
|
|
100
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Remove any duplicate rowIds. We have had instances where
|
|
105
|
+
* users encounter duplicate rowIds in the rowOrder.
|
|
106
|
+
* See: https://github.com/zionlabs/Issues/issues/1589
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
var cleanedValidRowOrder = [];
|
|
111
|
+
validRowOrder.forEach(function (rowId) {
|
|
112
|
+
if (cleanedValidRowOrder.indexOf(rowId) === -1) cleanedValidRowOrder.push(rowId);
|
|
113
|
+
});
|
|
101
114
|
|
|
102
115
|
if (filteredColumnIds.length > 0) {
|
|
103
116
|
var matchedRows = {};
|
|
@@ -111,11 +124,11 @@ var getFilteredRowOrder = function getFilteredRowOrder(rowOrder, rows, filters)
|
|
|
111
124
|
});
|
|
112
125
|
if (rowMatched) matchedRows[row._id] = true;
|
|
113
126
|
});
|
|
114
|
-
return
|
|
127
|
+
return cleanedValidRowOrder.filter(function (rowId) {
|
|
115
128
|
return matchedRows[rowId];
|
|
116
129
|
});
|
|
117
130
|
} else {
|
|
118
|
-
return
|
|
131
|
+
return cleanedValidRowOrder;
|
|
119
132
|
}
|
|
120
133
|
};
|
|
121
134
|
/**
|
|
@@ -657,7 +670,7 @@ var generateInputGroupFields = function generateInputGroupFields(field, columns)
|
|
|
657
670
|
activity.forEach(function (act) {
|
|
658
671
|
var rowId = act.document.row;
|
|
659
672
|
var columnId = act.document.column;
|
|
660
|
-
var cellKey = "".concat(field._id
|
|
673
|
+
var cellKey = "".concat(field._id).concat(rowId).concat(columnId);
|
|
661
674
|
if (!cellActivityLookup[cellKey]) cellActivityLookup[cellKey] = 0;
|
|
662
675
|
cellActivityLookup[cellKey] += 1;
|
|
663
676
|
});
|
|
@@ -671,7 +684,7 @@ var generateInputGroupFields = function generateInputGroupFields(field, columns)
|
|
|
671
684
|
*/
|
|
672
685
|
|
|
673
686
|
tableReferences.push({
|
|
674
|
-
uniqueId: "".concat(field._id
|
|
687
|
+
uniqueId: "".concat(field._id).concat(row._id),
|
|
675
688
|
_id: field._id,
|
|
676
689
|
title: field.title,
|
|
677
690
|
type: _Table.inputGroupFieldTypes.inputGroupRowHeader,
|
|
@@ -690,7 +703,7 @@ var generateInputGroupFields = function generateInputGroupFields(field, columns)
|
|
|
690
703
|
var lastColumnIndex = columnIndex === tableColumns.length - 1;
|
|
691
704
|
var value = row && row.cells ? row.cells[column._id] : '';
|
|
692
705
|
var displayValue = column.type === _FieldTableColumnTypes["default"].dropdown ? columnOptionValueLookup[column._id][value] : value;
|
|
693
|
-
var cellKey = "".concat(field._id
|
|
706
|
+
var cellKey = "".concat(field._id).concat(row._id).concat(column._id);
|
|
694
707
|
tableReferences.push({
|
|
695
708
|
uniqueId: cellKey,
|
|
696
709
|
_id: field._id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builttocreate/engine-utils",
|
|
3
|
-
"version": "1.9.1",
|
|
3
|
+
"version": "1.9.3-rc.1.0.2",
|
|
4
4
|
"description": "Utility library for common logic shared across web and mobile",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/polyfill": "^7.12.1",
|
|
48
48
|
"@builttocreate/hot-formula-parser": "4.0.1",
|
|
49
|
+
"moment": "^2.29.1",
|
|
49
50
|
"shortid": "^2.2.16"
|
|
50
51
|
},
|
|
51
52
|
"jest": {
|