@hmcts/ccd-case-ui-toolkit 7.0.2 → 7.0.3-exui-1123

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.
@@ -3239,6 +3239,11 @@ class WorkbasketInput {
3239
3239
 
3240
3240
  // @dynamic
3241
3241
  class FieldsUtils {
3242
+ static isValidDisplayContext(ctx) {
3243
+ return (ctx === 'MANDATORY' || ctx === 'READONLY'
3244
+ || ctx === 'OPTIONAL' || ctx === 'HIDDEN'
3245
+ || ctx === 'COMPLEX');
3246
+ }
3242
3247
  static convertToCaseField(obj) {
3243
3248
  if (!(obj instanceof CaseField)) {
3244
3249
  return plainToClassFromExist(new CaseField(), obj);
@@ -4391,7 +4396,11 @@ class AbstractFormFieldComponent {
4391
4396
  return control;
4392
4397
  }
4393
4398
  const existing = container.controls[this.caseField.id];
4399
+ // update the field value which has been set in mid-event call back
4394
4400
  if (existing) {
4401
+ if (existing.value === null && this.caseField?.value) {
4402
+ existing.value = this.caseField.value;
4403
+ }
4395
4404
  if (replace) {
4396
4405
  // Set the validators on the replacement with what already exists.
4397
4406
  control.setValidators(existing.validator);
@@ -5435,7 +5444,7 @@ class FormValueService {
5435
5444
  // Retain anything that is readonly and not a label.
5436
5445
  continue;
5437
5446
  }
5438
- if (field.hidden === true && field.display_context !== 'HIDDEN' && field.id !== 'caseLinks' && !field.retain_hidden_value) {
5447
+ if (field.hidden === true && field.display_context !== 'HIDDEN' && field.display_context !== 'HIDDEN_TEMP' && field.id !== 'caseLinks' && !field.retain_hidden_value) {
5439
5448
  // Delete anything that is hidden (that is NOT readonly), and that
5440
5449
  // hasn't had its display_context overridden to make it hidden.
5441
5450
  delete data[field.id];
@@ -7269,7 +7278,8 @@ class WizardPageFieldToCaseFieldMapper {
7269
7278
  childrenCaseFields.forEach(e => this.hideParentIfAllChildrenHidden(e));
7270
7279
  if (childrenCaseFields.length > 0 && this.allCaseFieldsHidden(childrenCaseFields)) {
7271
7280
  caseField.hidden = true;
7272
- caseField.display_context = 'HIDDEN';
7281
+ // marking display_context as special hidden so field not being deleted in event submission
7282
+ caseField.display_context = 'HIDDEN_TEMP';
7273
7283
  }
7274
7284
  }
7275
7285
  getCaseFieldChildren(caseField) {
@@ -7283,7 +7293,7 @@ class WizardPageFieldToCaseFieldMapper {
7283
7293
  return childrenCaseFields;
7284
7294
  }
7285
7295
  allCaseFieldsHidden(children) {
7286
- return !children.some(e => e.hidden !== true);
7296
+ return children.every(e => e.display_context === 'HIDDEN' || e.display_context === 'HIDDEN_TEMP');
7287
7297
  }
7288
7298
  }
7289
7299
  WizardPageFieldToCaseFieldMapper.ɵfac = function WizardPageFieldToCaseFieldMapper_Factory(t) { return new (t || WizardPageFieldToCaseFieldMapper)(); };
@@ -10146,7 +10156,9 @@ class FieldsFilterPipe {
10146
10156
  .filter(f => keepEmpty || FieldsFilterPipe.keepField(f))
10147
10157
  .map(f => {
10148
10158
  if (!f.display_context) {
10149
- f.display_context = complexField.display_context;
10159
+ if (FieldsUtils.isValidDisplayContext(complexField.display_context)) {
10160
+ f.display_context = complexField.display_context;
10161
+ }
10150
10162
  }
10151
10163
  return f;
10152
10164
  });
@@ -21993,7 +22005,9 @@ class ReadFieldsFilterPipe {
21993
22005
  })
21994
22006
  .map(f => {
21995
22007
  if (!f.display_context) {
21996
- f.display_context = complexField.display_context;
22008
+ if (FieldsUtils.isValidDisplayContext(complexField.display_context)) {
22009
+ f.display_context = complexField.display_context;
22010
+ }
21997
22011
  }
21998
22012
  if (setupHidden) {
21999
22013
  ReadFieldsFilterPipe.evaluateConditionalShow(f, checkConditionalShowAgainst, path, formGroupAvailable, complexField.id);