@hmcts/ccd-case-ui-toolkit 6.19.16-hearing-requirements-event-fix → 6.19.16-rc2

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.
@@ -5828,23 +5828,13 @@
5828
5828
  * @returns A new array with the mapped values
5829
5829
  */
5830
5830
  FieldsPurger.prototype.mapArrayValuesToNull = function (array) {
5831
- if (array && array.length > 0) {
5832
- return array.map(function (element) {
5833
- if (element !== undefined && element !== null) {
5834
- return typeof element === 'object'
5835
- ? Object.assign.apply(Object, __spread([{}], Object.keys(element).map(function (k) {
5836
- var _a;
5837
- return (_a = {}, _a[k] = null, _a);
5838
- }))) : null;
5839
- }
5840
- else {
5841
- return {};
5842
- }
5843
- });
5844
- }
5845
- else {
5846
- return array;
5847
- }
5831
+ return array.map(function (element) {
5832
+ return typeof element === 'object'
5833
+ ? Object.assign.apply(Object, __spread([{}], Object.keys(element).map(function (k) {
5834
+ var _a;
5835
+ return (_a = {}, _a[k] = null, _a);
5836
+ }))) : null;
5837
+ });
5848
5838
  };
5849
5839
  return FieldsPurger;
5850
5840
  }());
@@ -6419,7 +6409,7 @@
6419
6409
  if (!FormValueService.isLabel(field) && FormValueService.isReadOnly(field)) {
6420
6410
  return "continue";
6421
6411
  }
6422
- if (field.hidden === true && field.display_context !== 'HIDDEN' && field.id !== 'caseLinks' && !field.retain_hidden_value) {
6412
+ if (field.hidden === true && field.display_context !== 'HIDDEN' && field.display_context !== 'HIDDEN_TEMP' && field.id !== 'caseLinks' && !field.retain_hidden_value) {
6423
6413
  // Delete anything that is hidden (that is NOT readonly), and that
6424
6414
  // hasn't had its display_context overridden to make it hidden.
6425
6415
  delete data[field.id];
@@ -8716,7 +8706,8 @@
8716
8706
  childrenCaseFields.forEach(function (e) { return _this.hideParentIfAllChildrenHidden(e); });
8717
8707
  if (childrenCaseFields.length > 0 && this.allCaseFieldsHidden(childrenCaseFields)) {
8718
8708
  caseField.hidden = true;
8719
- caseField.display_context = 'HIDDEN';
8709
+ // marking display_context as special hidden so field not being deleted in event submission
8710
+ caseField.display_context = 'HIDDEN_TEMP';
8720
8711
  }
8721
8712
  };
8722
8713
  WizardPageFieldToCaseFieldMapper.prototype.getCaseFieldChildren = function (caseField) {
@@ -8730,7 +8721,7 @@
8730
8721
  return childrenCaseFields;
8731
8722
  };
8732
8723
  WizardPageFieldToCaseFieldMapper.prototype.allCaseFieldsHidden = function (children) {
8733
- return !children.some(function (e) { return e.hidden !== true; });
8724
+ return children.every(function (e) { return e.display_context === 'HIDDEN' || e.display_context === 'HIDDEN_TEMP'; });
8734
8725
  };
8735
8726
  return WizardPageFieldToCaseFieldMapper;
8736
8727
  }());
@@ -14180,7 +14171,10 @@
14180
14171
  .filter(function (f) { return keepEmpty || FieldsFilterPipe.keepField(f); })
14181
14172
  .map(function (f) {
14182
14173
  if (!f.display_context) {
14183
- f.display_context = complexField.display_context;
14174
+ if (complexField.display_context === 'MANDATORY' || complexField.display_context === 'READONLY'
14175
+ || complexField.display_context === 'OPTIONAL' || complexField.display_context === 'HIDDEN') {
14176
+ f.display_context = complexField.display_context;
14177
+ }
14184
14178
  }
14185
14179
  return f;
14186
14180
  });
@@ -26597,7 +26591,10 @@
26597
26591
  })
26598
26592
  .map(function (f) {
26599
26593
  if (!f.display_context) {
26600
- f.display_context = complexField.display_context;
26594
+ if (complexField.display_context === 'MANDATORY' || complexField.display_context === 'READONLY'
26595
+ || complexField.display_context === 'OPTIONAL' || complexField.display_context === 'HIDDEN') {
26596
+ f.display_context = complexField.display_context;
26597
+ }
26601
26598
  }
26602
26599
  if (setupHidden) {
26603
26600
  ReadFieldsFilterPipe.evaluateConditionalShow(f, checkConditionalShowAgainst, path, formGroupAvailable, complexField.id);