@hmcts/ccd-case-ui-toolkit 7.0.30-prerelease-ccd-label → 7.0.31-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.
@@ -5216,7 +5216,8 @@ class FieldTypeSanitiser {
5216
5216
  if (!data || !caseFields) {
5217
5217
  return;
5218
5218
  }
5219
- caseFields.forEach(caseField => {
5219
+ caseFields = this.ensureDynamicMultiSelectListPopulated(caseFields);
5220
+ caseFields.forEach((caseField) => {
5220
5221
  // tslint:disable-next-line:switch-default
5221
5222
  switch (caseField.field_type.type) {
5222
5223
  case FieldTypeSanitiser.FIELD_TYPE_DYNAMIC_MULTISELECT_LIST:
@@ -5239,6 +5240,16 @@ class FieldTypeSanitiser {
5239
5240
  }
5240
5241
  });
5241
5242
  }
5243
+ ensureDynamicMultiSelectListPopulated(caseFields) {
5244
+ return caseFields.map((field) => {
5245
+ if (field.field_type.type !== 'Complex') {
5246
+ return field;
5247
+ }
5248
+ 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 && field._value[complexField.id]
5249
+ ? { ...complexField, list_items: field._value[complexField.id].list_items } : complexField);
5250
+ return { ...field, field_type: { ...field.field_type, complex_fields: complexFieldsUpdated } };
5251
+ });
5252
+ }
5242
5253
  convertArrayToDynamicListOutput(field, data) {
5243
5254
  const values = data[field.id];
5244
5255
  if (Array.isArray(values)) {
@@ -20439,13 +20450,13 @@ ReadYesNoFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Rea
20439
20450
  i0.ɵɵelementEnd();
20440
20451
  } if (rf & 2) {
20441
20452
  i0.ɵɵadvance(1);
20442
- i0.ɵɵtextInterpolate(ctx.formattedValue ? i0.ɵɵpipeBind3(2, 1, ctx.formattedValue, null, ctx.formattedValue) : null);
20453
+ i0.ɵɵtextInterpolate(ctx.formattedValue ? i0.ɵɵpipeBind3(2, 1, ctx.caseField.label, null, ctx.formattedValue) : null);
20443
20454
  } }, dependencies: [i1.RpxTranslatePipe], encapsulation: 2 });
20444
20455
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadYesNoFieldComponent, [{
20445
20456
  type: Component,
20446
20457
  args: [{
20447
20458
  selector: 'ccd-read-yes-no-field',
20448
- template: `<span class="text-16">{{formattedValue ? (formattedValue | rpxTranslate : null : formattedValue) : null}}</span>`
20459
+ template: `<span class="text-16">{{formattedValue ? (caseField.label | rpxTranslate : null : formattedValue) : null}}</span>`
20449
20460
  }]
20450
20461
  }], function () { return [{ type: YesNoService }]; }, null); })();
20451
20462
 
@@ -20959,7 +20970,8 @@ class CaseFileViewFolderSelectorComponent {
20959
20970
  return [];
20960
20971
  }
20961
20972
  containsDocument(cat, document) {
20962
- if (cat.documents.findIndex((doc) => doc.document_binary_url === document.document_binary_url) > -1) {
20973
+ if (cat.documents.findIndex((doc) => (doc.document_binary_url === document.document_binary_url)
20974
+ && (doc.attribute_path === document.attribute_path)) > -1) {
20963
20975
  return [cat.category_id];
20964
20976
  }
20965
20977
  for (const c of cat.sub_categories) {