@builttocreate/engine-utils 1.16.0-rc2 → 1.16.0-rc4
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.
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Are we displaying the entire original field
|
|
10
|
+
*
|
|
11
|
+
* For instance, if displayType is original for a table field then we are
|
|
12
|
+
* displaying the entire component. If it is text,
|
|
13
|
+
* circle, square, etc. then that means we are
|
|
14
|
+
* only displaying an invidiual mapped cell from
|
|
15
|
+
* the table or input group. Same is true for dropdown and multi-select fields.
|
|
16
|
+
*/
|
|
17
|
+
var original = 'original';
|
|
18
|
+
/**
|
|
19
|
+
* Meant to be used as original display type but horizontal.
|
|
20
|
+
* Primarily used for multi-select field right now.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var horizontal = 'horizontal'; //Selector types: Used for individually mapping cells and options
|
|
24
|
+
|
|
25
|
+
var text = 'text';
|
|
26
|
+
var circle = 'circle';
|
|
27
|
+
var square = 'square';
|
|
28
|
+
var check = 'check';
|
|
29
|
+
var radio = 'radio';
|
|
30
|
+
var _default = {
|
|
31
|
+
original: original,
|
|
32
|
+
horizontal: horizontal,
|
|
33
|
+
text: text,
|
|
34
|
+
circle: circle,
|
|
35
|
+
square: square,
|
|
36
|
+
check: check,
|
|
37
|
+
radio: radio
|
|
38
|
+
};
|
|
39
|
+
exports["default"] = _default;
|
package/dist/formHelper.js
CHANGED
|
@@ -11,12 +11,16 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
11
11
|
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
|
|
14
|
+
var _fieldHelper = require("./fieldHelper");
|
|
15
|
+
|
|
14
16
|
var _generateObjectId = _interopRequireDefault(require("./generateObjectId"));
|
|
15
17
|
|
|
16
18
|
var _PageLayoutModes = _interopRequireDefault(require("./constants/PageLayoutModes"));
|
|
17
19
|
|
|
18
20
|
var _FieldStyleModes = _interopRequireDefault(require("./constants/FieldStyleModes"));
|
|
19
21
|
|
|
22
|
+
var _FieldDisplayTypes = _interopRequireDefault(require("./constants/FieldDisplayTypes"));
|
|
23
|
+
|
|
20
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
25
|
|
|
22
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -50,10 +54,7 @@ exports.getDefaultPage = getDefaultPage;
|
|
|
50
54
|
var formatv2Form = function formatv2Form(form) {
|
|
51
55
|
var pages = form.pages,
|
|
52
56
|
fields = form.fields;
|
|
53
|
-
var
|
|
54
|
-
fields.forEach(function (field) {
|
|
55
|
-
fieldsLookup[field._id] = field;
|
|
56
|
-
});
|
|
57
|
+
var populatedForm = (0, _fieldHelper.getTemplateWithLookups)(form);
|
|
57
58
|
/**
|
|
58
59
|
* Fully populated list of fields
|
|
59
60
|
*/
|
|
@@ -65,16 +66,30 @@ var formatv2Form = function formatv2Form(form) {
|
|
|
65
66
|
});
|
|
66
67
|
|
|
67
68
|
page.fields.forEach(function (pageFieldPosition) {
|
|
68
|
-
var field =
|
|
69
|
+
var field = populatedForm.fieldLookup[pageFieldPosition.field];
|
|
69
70
|
|
|
70
71
|
var formattedData = _objectSpread({
|
|
71
72
|
type: field.type
|
|
72
|
-
}, pageFieldPosition);
|
|
73
|
+
}, pageFieldPosition); //Add field position default parameters
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if (!formattedData.displayType) formattedData.displayType = _FieldDisplayTypes["default"].original;
|
|
77
|
+
|
|
78
|
+
if (formattedData.columnId && field.tableColumnsLookup[formattedData.columnId]) {
|
|
79
|
+
formattedData.columnType = field.tableColumnsLookup[formattedData.columnId].type;
|
|
80
|
+
} //Add field parameters
|
|
81
|
+
|
|
73
82
|
|
|
74
83
|
if (field.title) formattedData.title = field.title;
|
|
75
84
|
if (field.value) formattedData.value = field.value;
|
|
76
85
|
if (field.tableColumns) formattedData.tableColumns = field.tableColumns;
|
|
77
86
|
if (field.options) formattedData.tableColumns = field.options;
|
|
87
|
+
if (field.yTitle) formattedData.yTitle = field.yTitle;
|
|
88
|
+
if (typeof field.yMax === 'number') formattedData.yMax = field.yMax;
|
|
89
|
+
if (typeof field.yMin === 'number') formattedData.yMin = field.yMin;
|
|
90
|
+
if (field.xTitle) formattedData.xTitle = field.xTitle;
|
|
91
|
+
if (typeof field.xMax === 'number') formattedData.xMax = field.xMax;
|
|
92
|
+
if (typeof field.xMin === 'number') formattedData.xMin = field.xMin;
|
|
78
93
|
nextPage.fields.push(formattedData);
|
|
79
94
|
nextFields.push(formattedData);
|
|
80
95
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builttocreate/engine-utils",
|
|
3
|
-
"version": "1.16.0-
|
|
3
|
+
"version": "1.16.0-rc4",
|
|
4
4
|
"description": "Utility library for common logic shared across web and mobile",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/polyfill": "^7.12.1",
|
|
48
|
-
"@builttocreate/hot-formula-parser": "^5.0.0-
|
|
48
|
+
"@builttocreate/hot-formula-parser": "^5.0.0-rc2",
|
|
49
49
|
"moment": "^2.29.1"
|
|
50
50
|
},
|
|
51
51
|
"jest": {
|