@builttocreate/engine-utils 1.9.0 → 1.9.1-rc.1.0.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.
- package/dist/activityHelper.js +9 -4
- package/dist/constants/Roles.js +1 -0
- package/dist/tableHelper.js +4 -4
- package/package.json +2 -5
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;
|
|
@@ -138,8 +138,10 @@ var addDocumentDataToActivities = function addDocumentDataToActivities(activitie
|
|
|
138
138
|
*/
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
if (fieldRowsLookup[activity.document.field] && fieldRowIndexLookup[activity.document.field]) {
|
|
142
|
+
nextActivity.document.value = fieldRowsLookup[activity.document.field][activity.document.row];
|
|
143
|
+
nextActivity.document.rowIndex = fieldRowIndexLookup[activity.document.field][activity.document.row];
|
|
144
|
+
}
|
|
143
145
|
} else if (docFieldValue && templateField.type === _FieldTypes["default"].inputGroup) {
|
|
144
146
|
/**
|
|
145
147
|
* Input Group Step 1: create an easy way to lookup a row with the dropdown cells populated.
|
|
@@ -153,7 +155,9 @@ var addDocumentDataToActivities = function addDocumentDataToActivities(activitie
|
|
|
153
155
|
* whole row because input group display components are treated like regular field and not like table rows.
|
|
154
156
|
*/
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
if (fieldRowsLookup[activity.document.field] && fieldRowsLookup[activity.document.field][activity.document.row] && fieldRowsLookup[activity.document.field][activity.document.row].cells[activity.document.column]) {
|
|
159
|
+
nextActivity.document.value = fieldRowsLookup[activity.document.field][activity.document.row].cells[activity.document.column];
|
|
160
|
+
}
|
|
157
161
|
} else if (docFieldValue && templateField.type === _FieldTypes["default"].multiSelect) {
|
|
158
162
|
var parsedDocFieldValue = docFieldValue && typeof docFieldValue === 'string' ? docFieldValue.split(',') : docFieldValue;
|
|
159
163
|
var _nextDocFieldValue = '';
|
|
@@ -161,6 +165,7 @@ var addDocumentDataToActivities = function addDocumentDataToActivities(activitie
|
|
|
161
165
|
if (parsedDocFieldValue.length > 0) {
|
|
162
166
|
parsedDocFieldValue.forEach(function (item) {
|
|
163
167
|
var option = templateField.optionsLookup[item];
|
|
168
|
+
if (!option) return;
|
|
164
169
|
_nextDocFieldValue = _nextDocFieldValue.concat(' ', option.value);
|
|
165
170
|
});
|
|
166
171
|
}
|
package/dist/constants/Roles.js
CHANGED
|
@@ -11,6 +11,7 @@ exports["default"] = void 0;
|
|
|
11
11
|
* admin - They can do everything
|
|
12
12
|
* contributor - They can do everything, except modify users or templates
|
|
13
13
|
* readyOnly - They can see all but can't do anything.
|
|
14
|
+
* restricted - They can only see the stuff they authored. They don't have access to any other users stuff.
|
|
14
15
|
*/
|
|
15
16
|
var roles = {
|
|
16
17
|
admin: {
|
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 _hotFormulaParser = require("@builttocreate/hot-formula-parser");
|
|
19
|
+
|
|
18
20
|
var _Table = _interopRequireWildcard(require("./constants/Table"));
|
|
19
21
|
|
|
20
22
|
var _FieldTypes = _interopRequireDefault(require("./constants/FieldTypes"));
|
|
@@ -27,9 +29,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
27
29
|
|
|
28
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
31
|
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var parser = new FormulaParser();
|
|
32
|
+
var parser = new _hotFormulaParser.Parser();
|
|
33
33
|
|
|
34
34
|
var getTableFieldLookupKey = function getTableFieldLookupKey(fieldId, rowIndex, columnId) {
|
|
35
35
|
return "".concat(fieldId, "-").concat(rowIndex, "-").concat(columnId);
|
|
@@ -768,7 +768,7 @@ exports.getTableRowLookupWithPopulatedDropdownCells = getTableRowLookupWithPopul
|
|
|
768
768
|
|
|
769
769
|
var getInputGroupRowLookupWithPopulatedDropdownCells = function getInputGroupRowLookupWithPopulatedDropdownCells(columns, rows) {
|
|
770
770
|
var rowsLookup = {};
|
|
771
|
-
var validRows = typeof
|
|
771
|
+
var validRows = typeof rows === 'string' ? JSON.parse(rows) : rows;
|
|
772
772
|
validRows.forEach(function (row) {
|
|
773
773
|
var nextRow = _objectSpread(_objectSpread({}, row), {}, {
|
|
774
774
|
cells: _objectSpread({}, row.cells)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builttocreate/engine-utils",
|
|
3
|
-
"version": "1.9.0",
|
|
3
|
+
"version": "1.9.1-rc.1.0.0",
|
|
4
4
|
"description": "Utility library for common logic shared across web and mobile",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -53,9 +53,6 @@
|
|
|
53
53
|
"moduleNameMapper": {
|
|
54
54
|
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
|
|
55
55
|
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
|
|
56
|
-
}
|
|
57
|
-
"transformIgnorePatterns": [
|
|
58
|
-
"node_modules/(?!(jest-)?@builttocreate)"
|
|
59
|
-
]
|
|
56
|
+
}
|
|
60
57
|
}
|
|
61
58
|
}
|