@hmcts/ccd-case-ui-toolkit 4.7.1-EUI-4703-hearing-date → 4.8.0-rc.1

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/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @hmcts/ccd-case-ui-toolkit - Case UI Toolkit
3
- * @version v4.7.1-EUI-4703-hearing-date
3
+ * @version v4.8.0-rc.1
4
4
  * @link undefined
5
5
  * @license MIT
6
6
  */
@@ -29356,7 +29356,27 @@ var ShowCondition = /** @class */ (function () {
29356
29356
  if (!this.condition) {
29357
29357
  return true;
29358
29358
  }
29359
- return this.matchAndConditions(fields, path);
29359
+ return this.matchAndConditions(fields, this.updatePathName(path));
29360
+ };
29361
+ /**
29362
+ * Path Name gets updated for complex sub fields
29363
+ * @param path Path name.
29364
+ */
29365
+ ShowCondition.prototype.updatePathName = function (path) {
29366
+ if (path && path.split(/[_]+/g).length > 0) {
29367
+ var _a = path.split(/[_]+/g), pathName_1 = _a[0], pathTail = _a.slice(1);
29368
+ var pathFinalIndex_1 = pathTail.pop();
29369
+ var pathTailString = pathTail.toString();
29370
+ pathTail = pathTail.map(function (value) {
29371
+ return Number(pathFinalIndex_1) === Number(value) ? pathName_1 : value;
29372
+ });
29373
+ return pathTailString !== pathTail.toString()
29374
+ ? pathName_1 + "_" + pathTail.join('_') + "_" + pathFinalIndex_1
29375
+ : path;
29376
+ }
29377
+ else {
29378
+ return path;
29379
+ }
29360
29380
  };
29361
29381
  ShowCondition.prototype.matchByContextFields = function (contextFields) {
29362
29382
  return this.match(fields_utils_1.FieldsUtils.toValuesMap(contextFields));
@@ -35012,8 +35032,6 @@ var FormValueService = /** @class */ (function () {
35012
35032
  }
35013
35033
  break;
35014
35034
  case 'Collection':
35015
- // Check for valid collection data
35016
- this.removeInvalidCollectionData(data, field);
35017
35035
  // Get hold of the collection.
35018
35036
  var collection = data[field.id];
35019
35037
  // Check if we actually have a collection to work with.
@@ -35039,22 +35057,6 @@ var FormValueService = /** @class */ (function () {
35039
35057
  // Clear out any MultiSelect labels.
35040
35058
  FormValueService_1.removeMultiSelectLabels(data);
35041
35059
  };
35042
- /**
35043
- * Remove any empty or invalid arry with only id
35044
- *
35045
- * @param data The object tree of form values on which to perform the removal
35046
- * @param field {@link CaseField} domain model object for each field
35047
- */
35048
- FormValueService.prototype.removeInvalidCollectionData = function (data, field) {
35049
- if (data[field.id] && data[field.id].length > 0) {
35050
- for (var _i = 0, _a = data[field.id]; _i < _a.length; _i++) {
35051
- var objCollection = _a[_i];
35052
- if (Object.keys(objCollection).length === 1 && Object.keys(objCollection).indexOf('id') > -1) {
35053
- data[field.id] = [];
35054
- }
35055
- }
35056
- }
35057
- };
35058
35060
  /**
35059
35061
  * Remove any empty collection fields where a value of greater than zero is specified in the field's {@link FieldType}
35060
35062
  * `min` attribute.