@builttocreate/engine-utils 1.17.2-rc2 → 1.17.2-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.
@@ -15,6 +15,8 @@ var _fieldHelper = require("./fieldHelper");
15
15
 
16
16
  var _generateObjectId = _interopRequireDefault(require("./generateObjectId"));
17
17
 
18
+ var _FieldTypes = _interopRequireDefault(require("./constants/FieldTypes"));
19
+
18
20
  var _PageLayoutModes = _interopRequireDefault(require("./constants/PageLayoutModes"));
19
21
 
20
22
  var _FieldStyleModes = _interopRequireDefault(require("./constants/FieldStyleModes"));
@@ -36,6 +38,8 @@ var getDefaultPage = function getDefaultPage() {
36
38
  return _objectSpread({
37
39
  _id: (0, _generateObjectId["default"])(),
38
40
  name: 'New Page',
41
+ width: 816,
42
+ height: 1056,
39
43
  fields: [],
40
44
  layoutMode: _PageLayoutModes["default"].grid,
41
45
  fieldStyleMode: _FieldStyleModes["default"].normal
@@ -125,7 +129,7 @@ var getv2FormUpdatePayload = function getv2FormUpdatePayload(formPayload) {
125
129
  * and not on the fieldPosition object.
126
130
  */
127
131
 
128
- var fieldKeys = ['identifier', 'title', 'value', 'tableColumns', 'tableColumnOrder', 'options', 'yTitle', 'yMax', 'yMin', 'xTitle', 'xMax', 'xMin'];
132
+ var fieldKeys = ['identifier', 'type', 'title', 'value', 'tableColumns', 'tableColumnOrder', 'options', 'yTitle', 'yMax', 'yMin', 'xTitle', 'xMax', 'xMin'];
129
133
  /**
130
134
  * Step 1: Properly save fields and field postion date
131
135
  */
@@ -163,7 +167,16 @@ var getv2FormUpdatePayload = function getv2FormUpdatePayload(formPayload) {
163
167
  * we need to add it the new field to form.fields.
164
168
  */
165
169
 
166
- var fieldIndex = nextFieldsIndexLookup[fieldData._id];
170
+ var fieldIndex = nextFieldsIndexLookup[fieldData._id]; //Make sure proper tableColumnOrder is added
171
+
172
+ if (fieldData.type === _FieldTypes["default"].table || fieldData.type === _FieldTypes["default"].inputGroup) {
173
+ if (fieldPosition.tableColumns && (!fieldPosition.tableColumnOrder || fieldPosition.tableColumnOrder < 1)) {
174
+ fieldData.tableColumnOrder = [];
175
+ fieldPosition.tableColumns.forEach(function (col) {
176
+ if (!col.deleted) fieldData.tableColumnOrder.push(col._id);
177
+ });
178
+ }
179
+ }
167
180
 
168
181
  if (typeof fieldIndex !== 'number') {
169
182
  //Step 1.2.1 Field does not exist so add it
@@ -619,7 +619,7 @@ var generateTableLookup = function generateTableLookup(rows, columns) {
619
619
  if (!column.operand) return;
620
620
  var cellKey = "".concat(column.operand).concat(rowIndex + 1);
621
621
  var cellRawValue = row.cells[column._id] ? row.cells[column._id] : undefined;
622
- var cellValue = cellRawValue ? cellRawValue.trim() : undefined;
622
+ var cellValue = cellRawValue && typeof cellRawValue === 'string' ? cellRawValue.trim() : undefined;
623
623
  var formulaCell = cellValue !== undefined && cellValue.charAt(0) === '=';
624
624
  var containsOperands = cellValue !== undefined && cellValue.match(/[A-Z]([0-9]{1,10})/gi);
625
625
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builttocreate/engine-utils",
3
- "version": "1.17.2-rc2",
3
+ "version": "1.17.2-rc4",
4
4
  "description": "Utility library for common logic shared across web and mobile",
5
5
  "main": "dist/index.js",
6
6
  "files": [