@builttocreate/engine-utils 1.8.1-rc.1.2.9 → 1.8.1-rc.1.3.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 +6 -8
- package/dist/fieldHelper.js +30 -21
- package/dist/tableHelper.js +25 -11
- package/package.json +1 -1
package/dist/activityHelper.js
CHANGED
|
@@ -99,7 +99,6 @@ var addDocumentDataToActivities = function addDocumentDataToActivities(activitie
|
|
|
99
99
|
if (activity.document && activity.document._id && activity.document.field) {
|
|
100
100
|
var docFieldValue = fieldValues[activity.document.field];
|
|
101
101
|
var templateField = templateFieldLookup[activity.document.field];
|
|
102
|
-
var templateFieldColumn = templateField.tableColumnsLookup[activity.document.column];
|
|
103
102
|
nextActivity.document.title = templateField.title;
|
|
104
103
|
nextActivity.document.type = templateField.type;
|
|
105
104
|
nextActivity.document.columns = templateField.tableColumns;
|
|
@@ -117,9 +116,9 @@ var addDocumentDataToActivities = function addDocumentDataToActivities(activitie
|
|
|
117
116
|
* Added as a fix for table bug that did not display proper output for formula cells
|
|
118
117
|
* as rowIndex was messy
|
|
119
118
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
console.log('tableDoc field value', docFieldValue);
|
|
120
|
+
var nextDocFieldValue = (0, _tableHelper.getRows)(docFieldValue);
|
|
121
|
+
console.log('nextDocFiedlValues', nextDocFieldValue);
|
|
123
122
|
|
|
124
123
|
if (!fieldRowsLookup[templateField._id]) {
|
|
125
124
|
fieldRowsLookup[templateField._id] = (0, _tableHelper.getTableRowLookupWithPopulatedDropdownCells)(templateField.tableColumns, nextDocFieldValue);
|
|
@@ -159,7 +158,7 @@ var addDocumentDataToActivities = function addDocumentDataToActivities(activitie
|
|
|
159
158
|
* whole row because input group display components are treated like regular field and not like table rows.
|
|
160
159
|
*/
|
|
161
160
|
|
|
162
|
-
nextActivity.document.value = fieldRowsLookup[activity.document.field][activity.document.row].cells[
|
|
161
|
+
nextActivity.document.value = fieldRowsLookup[activity.document.field][activity.document.row].cells[activity.document.column];
|
|
163
162
|
} else if (docFieldValue && templateField.type === _FieldTypes["default"].multiSelect) {
|
|
164
163
|
var parsedDocFieldValue = docFieldValue && typeof docFieldValue === 'string' ? docFieldValue.split(',') : docFieldValue;
|
|
165
164
|
var _nextDocFieldValue = '';
|
|
@@ -169,10 +168,9 @@ var addDocumentDataToActivities = function addDocumentDataToActivities(activitie
|
|
|
169
168
|
var option = templateField.optionsLookup[item];
|
|
170
169
|
_nextDocFieldValue = _nextDocFieldValue.concat(' ', option.value);
|
|
171
170
|
});
|
|
172
|
-
nextActivity.document.value = _nextDocFieldValue;
|
|
173
|
-
} else {
|
|
174
|
-
nextActivity.document.value = 'No Option Selected';
|
|
175
171
|
}
|
|
172
|
+
|
|
173
|
+
nextActivity.document.value = _nextDocFieldValue;
|
|
176
174
|
} //This should handle adding the display value for selection and regular input fields
|
|
177
175
|
else {
|
|
178
176
|
var option = templateField.optionsLookup[docFieldValue];
|
package/dist/fieldHelper.js
CHANGED
|
@@ -182,6 +182,28 @@ var getImportFieldValues = function getImportFieldValues(template, importSource,
|
|
|
182
182
|
* @param {} template
|
|
183
183
|
* @returns
|
|
184
184
|
*/
|
|
185
|
+
// export const getTemplateWithLookups = (template) => {
|
|
186
|
+
// const nextTemplate = { ...template };
|
|
187
|
+
// nextTemplate.fields = template.fields.map((field) => {
|
|
188
|
+
// const nextField = { ...field };
|
|
189
|
+
// nextField.optionsLookup = {};
|
|
190
|
+
// if (nextField.options) {
|
|
191
|
+
// nextField.options.forEach((option) => nextField.optionsLookup[option._id] = option);
|
|
192
|
+
// }
|
|
193
|
+
// if (nextField.tableColumns) {
|
|
194
|
+
// nextField.tableColumnsLookup = {};
|
|
195
|
+
// nextField.tableColumns.forEach((column, index) => {
|
|
196
|
+
// const nextColumn = { ...column, optionsLookup: {} }
|
|
197
|
+
// if (nextColumn.options) {
|
|
198
|
+
// nextColumn.options.forEach((option) => nextColumn.optionsLookup[option._id] = option);
|
|
199
|
+
// }
|
|
200
|
+
// nextField.tableColumns[index] = nextColumn
|
|
201
|
+
// });
|
|
202
|
+
// }
|
|
203
|
+
// return nextField;
|
|
204
|
+
// });
|
|
205
|
+
// return nextTemplate;
|
|
206
|
+
// }
|
|
185
207
|
|
|
186
208
|
|
|
187
209
|
exports.getImportFieldValues = getImportFieldValues;
|
|
@@ -189,7 +211,9 @@ exports.getImportFieldValues = getImportFieldValues;
|
|
|
189
211
|
var getTemplateWithLookups = function getTemplateWithLookups(template) {
|
|
190
212
|
var nextTemplate = _objectSpread({}, template);
|
|
191
213
|
|
|
192
|
-
nextTemplate.fields =
|
|
214
|
+
nextTemplate.fields = [];
|
|
215
|
+
nextTemplate.fieldLookup = {};
|
|
216
|
+
template.fields.forEach(function (field) {
|
|
193
217
|
var nextField = _objectSpread({}, field);
|
|
194
218
|
|
|
195
219
|
nextField.optionsLookup = {};
|
|
@@ -212,30 +236,15 @@ var getTemplateWithLookups = function getTemplateWithLookups(template) {
|
|
|
212
236
|
return nextColumn.optionsLookup[option._id] = option;
|
|
213
237
|
});
|
|
214
238
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
* We are adding optionsLookup to the template.tableColumns to fetch the dropdown cell values inside
|
|
218
|
-
* getRowlookupWithPopulatedDropdownCells
|
|
219
|
-
*
|
|
220
|
-
* Why can't we use the tableColumnsLookup object that gets added to the template?
|
|
221
|
-
* We can use it but i will have map through table columns and add the optionsLookup
|
|
222
|
-
* to them within activity helper. Without options lookup we will not be able to fetch
|
|
223
|
-
* dropdown cell values
|
|
224
|
-
*
|
|
225
|
-
* * TableHelper logic to fetch values of drodpown cells
|
|
226
|
-
if (optionId && column.type === FieldTableColumnTypes.dropdown) {
|
|
227
|
-
nextRow.cells[column._id] = column.optionsLookup[optionId] ? column.optionsLookup[optionId].value : optionId;
|
|
228
|
-
}
|
|
229
|
-
*/
|
|
230
|
-
// column.optionsLookup = nextColumn.optionsLookup;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
nextField.tableColumns[index] = nextColumn; // nextField.tableColumnsLookup[nextColumn._id] = nextColumn;
|
|
239
|
+
|
|
240
|
+
nextField.tableColumns[index] = nextColumn;
|
|
234
241
|
});
|
|
235
242
|
}
|
|
236
243
|
|
|
237
|
-
|
|
244
|
+
nextTemplate.fields.push(nextField);
|
|
245
|
+
nextTemplate.fieldLookup[nextField._id] = nextField;
|
|
238
246
|
});
|
|
247
|
+
console.log('nextTemplate', nextTemplate);
|
|
239
248
|
return nextTemplate;
|
|
240
249
|
};
|
|
241
250
|
|
package/dist/tableHelper.js
CHANGED
|
@@ -731,7 +731,7 @@ exports.generateInputGroupFields = generateInputGroupFields;
|
|
|
731
731
|
var getTableRowLookupWithPopulatedDropdownCells = function getTableRowLookupWithPopulatedDropdownCells(columns, rows) {
|
|
732
732
|
var rowsLookup = {};
|
|
733
733
|
var tableLookup = generateTableLookup(rows, columns);
|
|
734
|
-
var validRows =
|
|
734
|
+
var validRows = getRows(rows); //Removing deleted columns so column operand doesn't look messy
|
|
735
735
|
|
|
736
736
|
var validColumns = columns.filter(function (column) {
|
|
737
737
|
return !column.deleted;
|
|
@@ -742,19 +742,34 @@ var getTableRowLookupWithPopulatedDropdownCells = function getTableRowLookupWith
|
|
|
742
742
|
});
|
|
743
743
|
|
|
744
744
|
validColumns.forEach(function (column, i) {
|
|
745
|
-
var
|
|
745
|
+
var columnOperand = getColumnOperand(i);
|
|
746
|
+
var cellOperand = getCellOperand(columnOperand, rowIndex + 1);
|
|
747
|
+
var value = tableLookup[cellOperand];
|
|
746
748
|
|
|
747
|
-
if (
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
nextRow.cells[column._id] =
|
|
751
|
-
} else if (optionId && column.type === _FieldTableColumnTypes["default"].dropdown) {
|
|
752
|
-
nextRow.cells[column._id] = column.optionsLookup[optionId] ? column.optionsLookup[optionId].value : optionId;
|
|
749
|
+
if (value && column.type === _FieldTableColumnTypes["default"].dropdown) {
|
|
750
|
+
nextRow.cells[column._id] = column.optionsLookup[value] ? column.optionsLookup[value].value : value;
|
|
751
|
+
} else {
|
|
752
|
+
nextRow.cells[column._id] = value;
|
|
753
753
|
}
|
|
754
754
|
});
|
|
755
755
|
rowsLookup[nextRow._id] = nextRow;
|
|
756
|
-
});
|
|
757
|
-
|
|
756
|
+
}); // validRows.forEach((row, rowIndex) => {
|
|
757
|
+
// const nextRow = {...row, cells: {...row.cells}};
|
|
758
|
+
// const validColumns = columns.filter((column) => !column.deleted);
|
|
759
|
+
// validColumns.forEach((column, i) => {
|
|
760
|
+
// const optionId = nextRow.cells[column._id];
|
|
761
|
+
// if(optionId && optionId.charAt(0) === '=' && column.type === FieldTableColumnTypes.text){
|
|
762
|
+
// const columnOperand = getColumnOperand(i);
|
|
763
|
+
// const cellOperand = getCellOperand(columnOperand,rowIndex+1 );
|
|
764
|
+
// nextRow.cells[column._id] = tableLookup[cellOperand];
|
|
765
|
+
// }
|
|
766
|
+
// else if (optionId && column.type === FieldTableColumnTypes.dropdown) {
|
|
767
|
+
// nextRow.cells[column._id] = column.optionsLookup[optionId] ? column.optionsLookup[optionId].value : optionId;
|
|
768
|
+
// }
|
|
769
|
+
// });
|
|
770
|
+
// rowsLookup[nextRow._id] = nextRow;
|
|
771
|
+
// });
|
|
772
|
+
|
|
758
773
|
return rowsLookup;
|
|
759
774
|
};
|
|
760
775
|
/**
|
|
@@ -788,7 +803,6 @@ var getInputGroupRowLookupWithPopulatedDropdownCells = function getInputGroupRow
|
|
|
788
803
|
});
|
|
789
804
|
rowsLookup[nextRow._id] = nextRow;
|
|
790
805
|
});
|
|
791
|
-
console.log('input group rows lookup', rowsLookup);
|
|
792
806
|
return rowsLookup;
|
|
793
807
|
};
|
|
794
808
|
/**
|