@builttocreate/engine-utils 2.9.1-beta.1053.0 → 2.9.1-beta.1139

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.
@@ -8,7 +8,7 @@ var text = 'text';
8
8
  var dropdown = 'dropdown';
9
9
  var image = 'image';
10
10
  var number = 'number';
11
- var multiselect = 'multiselect';
11
+ var multiSelect = 'multiSelect';
12
12
  var date = 'date';
13
13
  var block = 'block';
14
14
  var barcode = 'barcode';
@@ -20,7 +20,7 @@ var _default = exports["default"] = {
20
20
  number: number,
21
21
  date: date,
22
22
  block: block,
23
- multiselect: multiselect,
23
+ multiSelect: multiSelect,
24
24
  barcode: barcode,
25
25
  signature: signature
26
26
  };
@@ -431,8 +431,8 @@ var getDefaultMultiselectColumn = exports.getDefaultMultiselectColumn = function
431
431
  var options = defaults.options || [getDefaultColumnOption('Option 1', '#f0f0f0'), getDefaultColumnOption('Option 2', '#f0f0f0'), getDefaultColumnOption('Option 3', '#f0f0f0')];
432
432
  return _objectSpread({
433
433
  _id: (0, _generateObjectId["default"])(),
434
- type: _FieldTableColumnTypes["default"].multiselect,
435
- title: 'Multiselect Column',
434
+ type: _FieldTableColumnTypes["default"].multiSelect,
435
+ title: 'MultiSelect Column',
436
436
  deleted: false,
437
437
  width: 200,
438
438
  options: options
@@ -762,11 +762,44 @@ var generateTableLookup = exports.generateTableLookup = function generateTableLo
762
762
  return !row.deleted;
763
763
  });
764
764
  var formulaCells = [];
765
+
766
+ // tableRows.forEach((row, rowIndex) => {
767
+ // tableColumns.forEach((column) => {
768
+ // if (!column.operand) return;
769
+
770
+ // const cellKey = `${column.operand}${rowIndex + 1}`;
771
+ // const cellRawValue = row.cells[column._id] ? row.cells[column._id] : undefined;
772
+
773
+ // let cellValue;
774
+ // if (cellRawValue && typeof cellRawValue === 'string') cellValue = cellRawValue.trim();
775
+ // if (cellRawValue && typeof cellRawValue === 'number') cellValue = cellRawValue.toString();
776
+
777
+ // const formulaCell = cellValue !== undefined && cellValue.charAt(0) === '=';
778
+ // const containsOperands = cellValue !== undefined && cellValue.match(/[A-Z]([0-9]{1,10})/gi);
779
+
780
+ // if (cellValue && column.type === FieldTableColumnTypes.dropdown) {
781
+ // tableLookup[cellKey] = columnOptionsLookup[column._id][cellValue];
782
+ // } else if ((cellValue || cellRawValue) && column.type === FieldTableColumnTypes.image) {
783
+ // tableLookup[cellKey] = cellRawValue;
784
+ // } else if (cellValue && formulaCell && containsOperands) {
785
+ // formulaCells.push(cellKey);
786
+ // tableLookup[cellKey] = cellValue;
787
+ // } else {
788
+ // tableLookup[cellKey] = cellValue || '';
789
+ // }
790
+ // });
791
+ // });
792
+
765
793
  tableRows.forEach(function (row, rowIndex) {
794
+ var cells = row.cells || {}; // Fallback if missing
795
+
796
+ // eslint-disable-next-line no-console
797
+ if (!row.cells) console.warn("Missing 'cells' in row: ".concat(row._id));
766
798
  tableColumns.forEach(function (column) {
767
799
  if (!column.operand) return;
768
800
  var cellKey = "".concat(column.operand).concat(rowIndex + 1);
769
- var cellRawValue = row.cells[column._id] ? row.cells[column._id] : undefined;
801
+ var cellRawValue = cells[column._id]; // Safe access
802
+
770
803
  var cellValue;
771
804
  if (cellRawValue && typeof cellRawValue === 'string') cellValue = cellRawValue.trim();
772
805
  if (cellRawValue && typeof cellRawValue === 'number') cellValue = cellRawValue.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builttocreate/engine-utils",
3
- "version": "2.9.1-beta.1053.0",
3
+ "version": "2.9.1-beta.1139",
4
4
  "description": "Utility library for common logic shared across web and mobile",
5
5
  "main": "dist/index.js",
6
6
  "files": [