@hmcts/ccd-case-ui-toolkit 7.0.25-disable-buttons-readonly → 7.0.25

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.
@@ -12692,7 +12692,7 @@ function WriteCollectionFieldComponent_div_9_div_1_Template(rf, ctx) { if (rf &
12692
12692
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(7, 14, ctx_r5.itemLabel(i_r7)));
12693
12693
  i0.ɵɵadvance(3);
12694
12694
  i0.ɵɵattributeInterpolate1("aria-label", "Remove ", ctx_r5.itemLabel(i_r7), "");
12695
- i0.ɵɵproperty("disabled", ctx_r5.isNotAuthorisedToDelete(i_r7) || ctx_r5.allFieldsReadOnly);
12695
+ i0.ɵɵproperty("disabled", ctx_r5.isNotAuthorisedToDelete(i_r7));
12696
12696
  i0.ɵɵadvance(1);
12697
12697
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 16, "Remove"));
12698
12698
  i0.ɵɵadvance(2);
@@ -12717,7 +12717,7 @@ function WriteCollectionFieldComponent_button_10_Template(rf, ctx) { if (rf & 1)
12717
12717
  i0.ɵɵelementEnd();
12718
12718
  } if (rf & 2) {
12719
12719
  const ctx_r2 = i0.ɵɵnextContext();
12720
- i0.ɵɵproperty("disabled", ctx_r2.isNotAuthorisedToCreate() || ctx_r2.isSearchFilter() || ctx_r2.allFieldsReadOnly);
12720
+ i0.ɵɵproperty("disabled", ctx_r2.isNotAuthorisedToCreate() || ctx_r2.isSearchFilter());
12721
12721
  i0.ɵɵadvance(1);
12722
12722
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 2, "Add new"));
12723
12723
  } }
@@ -12730,7 +12730,6 @@ class WriteCollectionFieldComponent extends AbstractFieldWriteComponent {
12730
12730
  this.cdRef = cdRef;
12731
12731
  this.caseFields = [];
12732
12732
  this.collItems = [];
12733
- this.allFieldsReadOnly = false;
12734
12733
  }
12735
12734
  ngOnInit() {
12736
12735
  if (!this.isExpanded) { // meaning I am not rendered on the search/workbasket input filter
@@ -12748,7 +12747,6 @@ class WriteCollectionFieldComponent extends AbstractFieldWriteComponent {
12748
12747
  }
12749
12748
  this.collItems[index] = { caseField, item, prefix, index, container };
12750
12749
  });
12751
- this.allFieldsReadOnly = this.checkComplexFieldReadOnly();
12752
12750
  }
12753
12751
  ngOnDestroy() {
12754
12752
  if (this.profileSubscription) {
@@ -12982,26 +12980,6 @@ class WriteCollectionFieldComponent extends AbstractFieldWriteComponent {
12982
12980
  const id = this.getControlIdAt(index);
12983
12981
  return !!id && !this.getCollectionPermission(this.caseField, 'allowDelete');
12984
12982
  }
12985
- checkComplexFieldReadOnly() {
12986
- return this.checkComplexFieldsReadOnly(this.caseField);
12987
- }
12988
- checkFieldType(caseField) {
12989
- return caseField?.field_type?.type === 'Collection'
12990
- ? caseField.field_type.collection_field_type?.complex_fields || []
12991
- : caseField?.field_type?.complex_fields || [];
12992
- }
12993
- checkComplexFieldsReadOnly(caseField) {
12994
- const children = this.checkFieldType(caseField);
12995
- if (children.length === 0) {
12996
- return caseField.display_context === 'READONLY';
12997
- }
12998
- return children.every((child) => {
12999
- if (!['Collection', 'Complex'].includes(child.field_type.type)) {
13000
- return child.display_context === 'READONLY';
13001
- }
13002
- return this.checkComplexFieldsReadOnly(child);
13003
- });
13004
- }
13005
12983
  openModal(i) {
13006
12984
  const dialogConfig = new MatDialogConfig();
13007
12985
  dialogConfig.disableClose = true;
@@ -13061,7 +13039,7 @@ WriteCollectionFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ typ
13061
13039
  i0.ɵɵadvance(3);
13062
13040
  i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(4, 7, ctx.caseField), " ");
13063
13041
  i0.ɵɵadvance(2);
13064
- i0.ɵɵproperty("disabled", ctx.isNotAuthorisedToCreate() || ctx.isSearchFilter() || ctx.allFieldsReadOnly);
13042
+ i0.ɵɵproperty("disabled", ctx.isNotAuthorisedToCreate() || ctx.isSearchFilter());
13065
13043
  i0.ɵɵadvance(1);
13066
13044
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(7, 9, "Add new"));
13067
13045
  i0.ɵɵadvance(2);
@@ -13073,7 +13051,7 @@ WriteCollectionFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ typ
13073
13051
  } }, styles: [".collection-field-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:first-child > td[_ngcontent-%COMP%]{padding-top:0}.collection-field-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:last-child > td[_ngcontent-%COMP%]{border-bottom:none}.collection-field-table[_ngcontent-%COMP%] td.collection-actions[_ngcontent-%COMP%]{width:1px;white-space:nowrap}.error-spacing[_ngcontent-%COMP%]{margin-top:10px}.collection-title[_ngcontent-%COMP%]{height:51px}.float-left[_ngcontent-%COMP%]{float:left;padding-top:8px}.float-right[_ngcontent-%COMP%]{float:right}.complex-panel[_ngcontent-%COMP%]{margin:13px 0;border:1px solid #bfc1c3}.complex-panel[_ngcontent-%COMP%] .complex-panel-title[_ngcontent-%COMP%]{background-color:#dee0e2;padding:5px 5px 2px;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width: 641px){.complex-panel[_ngcontent-%COMP%] .complex-panel-title[_ngcontent-%COMP%]{font-size:19px;line-height:1.3157894737}}.complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%]{vertical-align:top}.complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]:last-child > th[_ngcontent-%COMP%], .complex-panel[_ngcontent-%COMP%] .complex-panel-table[_ngcontent-%COMP%] > tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]:last-child > td[_ngcontent-%COMP%]{border-bottom:none}.complex-panel[_ngcontent-%COMP%] .complex-panel-simple-field[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding-left:5px;width:295px}.complex-panel[_ngcontent-%COMP%] .complex-panel-compound-field[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:5px}.collection-indicator[_ngcontent-%COMP%]{border-left:solid 5px #b1b4b6}"] });
13074
13052
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteCollectionFieldComponent, [{
13075
13053
  type: Component,
13076
- args: [{ selector: 'ccd-write-collection-field', template: "<div class=\"form-group\" [id]=\"id()\">\n\n <div class=\"panel collection-indicator\">\n\n <h2 class=\"heading-h2 error-spacing\">\n {{(caseField | ccdFieldLabel)}}\n </h2>\n <button class=\"button write-collection-add-item__top\" type=\"button\" (click)=\"addItem(true)\" [disabled]=\"isNotAuthorisedToCreate() || isSearchFilter() || allFieldsReadOnly\">{{'Add new' | rpxTranslate}}</button>\n <h2 class=\"heading-h2 error-spacing\" *ngIf=\"caseField.hint_text || formArray.errors\">\n <span *ngIf=\"caseField.hint_text\" class=\"form-hint\">{{caseField.hint_text | rpxTranslate }}</span>\n <span *ngIf=\"formArray.errors\" class=\"error-message\">\n {{(formArray.errors | ccdFirstError:caseField.label)}}\n </span>\n </h2>\n\n <div class=\"form-group\" [hidden]=\"caseField.hidden\" *ngIf=\"caseField.value && caseField.value.length\">\n <div *ngFor=\"let item of collItems; let i = index\" #collectionItem\n [id]=\"this.buildIdPrefix(i) + i\" class=\"form-group\">\n <div class=\"collection-title\">\n <div class=\"float-left\">\n <label [for]=\"item.prefix + i\"><h3 class=\"heading-h3\">{{itemLabel(i) | rpxTranslate}}</h3></label>\n </div>\n <div class=\"float-right\">\n <button class=\"button button-secondary\" type=\"button\" (click)=\"openModal(i)\"\n [disabled]=\"isNotAuthorisedToDelete(i) || allFieldsReadOnly\"\n attr.aria-label=\"Remove {{ itemLabel(i) }}\">{{'Remove' | rpxTranslate}}</button>\n </div>\n </div>\n <ccd-field-write [caseField]=\"item.caseField\"\n [caseFields]=\"caseFields\"\n [formGroup]=\"formGroup\"\n [parent]=\"item.container\"\n [idPrefix]=\"item.prefix\"\n [hidden]=\"item.caseField.hidden\"\n [isExpanded]=\"isExpanded\"\n [isInSearchBlock]=\"isInSearchBlock\">\n </ccd-field-write>\n </div>\n\n </div>\n\n <button class=\"button write-collection-add-item__bottom\" type=\"button\" (click)=\"addItem(false)\" [disabled]=\"isNotAuthorisedToCreate() || isSearchFilter() || allFieldsReadOnly\" *ngIf=\"caseField.value && caseField.value.length\">{{'Add new' | rpxTranslate }}</button>\n\n </div>\n\n</div>\n", styles: [".collection-field-table tr:first-child>td{padding-top:0}.collection-field-table tr:last-child>td{border-bottom:none}.collection-field-table td.collection-actions{width:1px;white-space:nowrap}.error-spacing{margin-top:10px}.collection-title{height:51px}.float-left{float:left;padding-top:8px}.float-right{float:right}.complex-panel{margin:13px 0;border:1px solid #bfc1c3}.complex-panel .complex-panel-title{background-color:#dee0e2;padding:5px 5px 2px;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width: 641px){.complex-panel .complex-panel-title{font-size:19px;line-height:1.3157894737}}.complex-panel .complex-panel-table>tbody>tr>th{vertical-align:top}.complex-panel .complex-panel-table>tbody>tr:last-child>th,.complex-panel .complex-panel-table>tbody>tr:last-child>td{border-bottom:none}.complex-panel .complex-panel-simple-field th{padding-left:5px;width:295px}.complex-panel .complex-panel-compound-field td{padding:5px}.collection-indicator{border-left:solid 5px #b1b4b6}\n"] }]
13054
+ args: [{ selector: 'ccd-write-collection-field', template: "<div class=\"form-group\" [id]=\"id()\">\n\n <div class=\"panel collection-indicator\">\n\n <h2 class=\"heading-h2 error-spacing\">\n {{(caseField | ccdFieldLabel)}}\n </h2>\n <button class=\"button write-collection-add-item__top\" type=\"button\" (click)=\"addItem(true)\" [disabled]=\"isNotAuthorisedToCreate() || isSearchFilter()\">{{'Add new' | rpxTranslate}}</button>\n <h2 class=\"heading-h2 error-spacing\" *ngIf=\"caseField.hint_text || formArray.errors\">\n <span *ngIf=\"caseField.hint_text\" class=\"form-hint\">{{caseField.hint_text | rpxTranslate }}</span>\n <span *ngIf=\"formArray.errors\" class=\"error-message\">\n {{(formArray.errors | ccdFirstError:caseField.label)}}\n </span>\n </h2>\n\n <div class=\"form-group\" [hidden]=\"caseField.hidden\" *ngIf=\"caseField.value && caseField.value.length\">\n <div *ngFor=\"let item of collItems; let i = index\" #collectionItem\n [id]=\"this.buildIdPrefix(i) + i\" class=\"form-group\">\n <div class=\"collection-title\">\n <div class=\"float-left\">\n <label [for]=\"item.prefix + i\"><h3 class=\"heading-h3\">{{itemLabel(i) | rpxTranslate}}</h3></label>\n </div>\n <div class=\"float-right\">\n <button class=\"button button-secondary\" type=\"button\" (click)=\"openModal(i)\"\n [disabled]=\"isNotAuthorisedToDelete(i)\"\n attr.aria-label=\"Remove {{ itemLabel(i) }}\">{{'Remove' | rpxTranslate}}</button>\n </div>\n </div>\n <ccd-field-write [caseField]=\"item.caseField\"\n [caseFields]=\"caseFields\"\n [formGroup]=\"formGroup\"\n [parent]=\"item.container\"\n [idPrefix]=\"item.prefix\"\n [hidden]=\"item.caseField.hidden\"\n [isExpanded]=\"isExpanded\"\n [isInSearchBlock]=\"isInSearchBlock\">\n </ccd-field-write>\n </div>\n\n </div>\n\n <button class=\"button write-collection-add-item__bottom\" type=\"button\" (click)=\"addItem(false)\" [disabled]=\"isNotAuthorisedToCreate() || isSearchFilter()\" *ngIf=\"caseField.value && caseField.value.length\">{{'Add new' | rpxTranslate }}</button>\n\n </div>\n\n</div>\n", styles: [".collection-field-table tr:first-child>td{padding-top:0}.collection-field-table tr:last-child>td{border-bottom:none}.collection-field-table td.collection-actions{width:1px;white-space:nowrap}.error-spacing{margin-top:10px}.collection-title{height:51px}.float-left{float:left;padding-top:8px}.float-right{float:right}.complex-panel{margin:13px 0;border:1px solid #bfc1c3}.complex-panel .complex-panel-title{background-color:#dee0e2;padding:5px 5px 2px;border-bottom:1px solid #bfc1c3;display:block;color:#0b0c0c;font-family:nta,Arial,sans-serif;font-weight:700;text-transform:none;font-size:16px;line-height:1.25}@media (min-width: 641px){.complex-panel .complex-panel-title{font-size:19px;line-height:1.3157894737}}.complex-panel .complex-panel-table>tbody>tr>th{vertical-align:top}.complex-panel .complex-panel-table>tbody>tr:last-child>th,.complex-panel .complex-panel-table>tbody>tr:last-child>td{border-bottom:none}.complex-panel .complex-panel-simple-field th{padding-left:5px;width:295px}.complex-panel .complex-panel-compound-field td{padding:5px}.collection-indicator{border-left:solid 5px #b1b4b6}\n"] }]
13077
13055
  }], function () { return [{ type: i1$3.MatLegacyDialog }, { type: i2.ScrollToService }, { type: ProfileNotifier }, { type: i0.ChangeDetectorRef }]; }, { caseFields: [{
13078
13056
  type: Input
13079
13057
  }], formGroup: [{