@hmcts/ccd-case-ui-toolkit 7.0.32 → 7.0.33-dynamic-multi-list-fix

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.
@@ -3043,7 +3043,9 @@ class CaseField {
3043
3043
  }
3044
3044
  }
3045
3045
  set list_items(items) {
3046
- this._list_items = items;
3046
+ if ((items && !this._list_items) || (items?.length > this._list_items?.length)) {
3047
+ this._list_items = items;
3048
+ }
3047
3049
  }
3048
3050
  get dateTimeEntryFormat() {
3049
3051
  if (this.isComplexDisplay()) {
@@ -5216,7 +5218,8 @@ class FieldTypeSanitiser {
5216
5218
  if (!data || !caseFields) {
5217
5219
  return;
5218
5220
  }
5219
- caseFields.forEach(caseField => {
5221
+ caseFields = this.ensureDynamicMultiSelectListPopulated(caseFields);
5222
+ caseFields.forEach((caseField) => {
5220
5223
  // tslint:disable-next-line:switch-default
5221
5224
  switch (caseField.field_type.type) {
5222
5225
  case FieldTypeSanitiser.FIELD_TYPE_DYNAMIC_MULTISELECT_LIST:
@@ -5239,6 +5242,16 @@ class FieldTypeSanitiser {
5239
5242
  }
5240
5243
  });
5241
5244
  }
5245
+ ensureDynamicMultiSelectListPopulated(caseFields) {
5246
+ return caseFields.map((field) => {
5247
+ if (field.field_type.type !== 'Complex') {
5248
+ return field;
5249
+ }
5250
+ const complexFieldsUpdated = field.field_type.complex_fields.map((complexField) => complexField.field_type.type === FieldTypeSanitiser.FIELD_TYPE_DYNAMIC_MULTISELECT_LIST && complexField.display_context !== 'HIDDEN' && field._value?.[complexField.id]
5251
+ ? { ...complexField, list_items: field._value[complexField.id]?.list_items } : complexField);
5252
+ return { ...field, field_type: { ...field.field_type, complex_fields: complexFieldsUpdated } };
5253
+ });
5254
+ }
5242
5255
  convertArrayToDynamicListOutput(field, data) {
5243
5256
  const values = data[field.id];
5244
5257
  if (Array.isArray(values)) {
@@ -20439,13 +20452,13 @@ ReadYesNoFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Rea
20439
20452
  i0.ɵɵelementEnd();
20440
20453
  } if (rf & 2) {
20441
20454
  i0.ɵɵadvance(1);
20442
- i0.ɵɵtextInterpolate(ctx.formattedValue ? i0.ɵɵpipeBind3(2, 1, ctx.caseField.label, null, ctx.formattedValue) : null);
20455
+ i0.ɵɵtextInterpolate(ctx.formattedValue ? i0.ɵɵpipeBind3(2, 1, ctx.formattedValue, null, ctx.formattedValue) : null);
20443
20456
  } }, dependencies: [i1.RpxTranslatePipe], encapsulation: 2 });
20444
20457
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadYesNoFieldComponent, [{
20445
20458
  type: Component,
20446
20459
  args: [{
20447
20460
  selector: 'ccd-read-yes-no-field',
20448
- template: `<span class="text-16">{{formattedValue ? (caseField.label | rpxTranslate : null : formattedValue) : null}}</span>`
20461
+ template: `<span class="text-16">{{formattedValue ? (formattedValue | rpxTranslate : null : formattedValue) : null}}</span>`
20449
20462
  }]
20450
20463
  }], function () { return [{ type: YesNoService }]; }, null); })();
20451
20464