@hmcts/rpx-xui-common-lib 1.7.18-caa-case-share-ui-changes → 1.7.18-caa-case-share-ui-changes-3

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.
Files changed (27) hide show
  1. package/bundles/hmcts-rpx-xui-common-lib.umd.js +46 -65
  2. package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +1 -1
  3. package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +1 -1
  4. package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +1 -1
  5. package/esm2015/hmcts-rpx-xui-common-lib.js +2 -2
  6. package/esm2015/lib/components/selected-case/selected-case.component.js +1 -7
  7. package/esm2015/lib/components/share-case/share-case.component.js +27 -28
  8. package/esm2015/lib/models/case-share.model.js +6 -1
  9. package/esm2015/lib/models/index.js +2 -2
  10. package/esm2015/lib/services/case-sharing-state/case-sharing-state.service.js +8 -6
  11. package/esm2015/public-api.js +2 -2
  12. package/esm5/hmcts-rpx-xui-common-lib.js +2 -2
  13. package/esm5/lib/components/selected-case/selected-case.component.js +1 -10
  14. package/esm5/lib/components/share-case/share-case.component.js +30 -45
  15. package/esm5/lib/models/case-share.model.js +6 -1
  16. package/esm5/lib/models/index.js +2 -2
  17. package/esm5/lib/services/case-sharing-state/case-sharing-state.service.js +8 -6
  18. package/esm5/public-api.js +2 -2
  19. package/fesm2015/hmcts-rpx-xui-common-lib.js +35 -45
  20. package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
  21. package/fesm5/hmcts-rpx-xui-common-lib.js +38 -65
  22. package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
  23. package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
  24. package/lib/components/selected-case/selected-case.component.d.ts +0 -1
  25. package/lib/components/share-case/share-case.component.d.ts +7 -1
  26. package/lib/models/case-share.model.d.ts +3 -0
  27. package/package.json +1 -1
@@ -2066,11 +2066,13 @@
2066
2066
  * @return {?}
2067
2067
  */
2068
2068
  function (caseId) {
2069
- for (var i = 0, l = this.caseState.length; i < l; i++) {
2070
- if (this.caseState[i].caseId === caseId) {
2071
- this.caseState.splice(i, 1);
2072
- this.subject.next(this.caseState);
2073
- return;
2069
+ if (this.caseState.length > 1) {
2070
+ for (var i = 0, l = this.caseState.length; i < l; i++) {
2071
+ if (this.caseState[i].caseId === caseId) {
2072
+ this.caseState.splice(i, 1);
2073
+ this.subject.next(this.caseState);
2074
+ return;
2075
+ }
2074
2076
  }
2075
2077
  }
2076
2078
  };
@@ -2301,15 +2303,6 @@
2301
2303
  this.combinedSortedShares = this.combineAndSortShares(sharedWith, pendingShares);
2302
2304
  }
2303
2305
  };
2304
- /**
2305
- * @return {?}
2306
- */
2307
- SelectedCaseComponent.prototype.onUnselect = /**
2308
- * @return {?}
2309
- */
2310
- function () {
2311
- this.unselect.emit(this.sharedCase);
2312
- };
2313
2306
  /**
2314
2307
  * @param {?} c
2315
2308
  * @return {?}
@@ -2942,6 +2935,16 @@
2942
2935
  return ShareCaseConfirmComponent;
2943
2936
  }());
2944
2937
 
2938
+ /**
2939
+ * @fileoverview added by tsickle
2940
+ * Generated from: lib/models/case-share.model.ts
2941
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2942
+ */
2943
+ /** @enum {string} */
2944
+ var SharedCaseErrorMessages = {
2945
+ OneCaseMustBeSelected: "At least one case must be selected",
2946
+ };
2947
+
2945
2948
  /**
2946
2949
  * @fileoverview added by tsickle
2947
2950
  * Generated from: lib/components/user-select/user-select.component.ts
@@ -3072,8 +3075,12 @@
3072
3075
  // users of this organisation the cases can be shared with
3073
3076
  this.confirmLink = '';
3074
3077
  this.showRemoveUsers = false;
3078
+ this.fnTitle = '';
3079
+ this.title = '';
3075
3080
  this.unselect = new i0.EventEmitter();
3076
3081
  this.synchronizeStore = new i0.EventEmitter();
3082
+ this.validationErrors = [];
3083
+ this.shareCaseErrorMessage = '';
3077
3084
  }
3078
3085
  /**
3079
3086
  * @return {?}
@@ -3101,8 +3108,16 @@
3101
3108
  * @return {?}
3102
3109
  */
3103
3110
  function (c) {
3104
- this.unselect.emit(c);
3105
- this.stateService.removeCase(c.caseId);
3111
+ this.validationErrors = [];
3112
+ if (this.stateService.getCases().length === 1) {
3113
+ this.validationErrors.push({ id: 'cases', message: SharedCaseErrorMessages.OneCaseMustBeSelected });
3114
+ this.shareCaseErrorMessage = SharedCaseErrorMessages.OneCaseMustBeSelected;
3115
+ window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
3116
+ }
3117
+ else {
3118
+ this.unselect.emit(c);
3119
+ this.stateService.removeCase(c.caseId);
3120
+ }
3106
3121
  };
3107
3122
  /**
3108
3123
  * @param {?} event
@@ -3150,49 +3165,6 @@
3150
3165
  function () {
3151
3166
  return this.selectedUser === null || this.shareCases.length === 0;
3152
3167
  };
3153
- /**
3154
- * @return {?}
3155
- */
3156
- ShareCaseComponent.prototype.isDisabledContinue = /**
3157
- * @return {?}
3158
- */
3159
- function () {
3160
- /** @type {?} */
3161
- var isDisabled = true;
3162
- this.shareCases$.subscribe(( /**
3163
- * @param {?} shareCases
3164
- * @return {?}
3165
- */function (shareCases) {
3166
- var e_1, _a;
3167
- try {
3168
- for (var shareCases_1 = __values(shareCases), shareCases_1_1 = shareCases_1.next(); !shareCases_1_1.done; shareCases_1_1 = shareCases_1.next()) {
3169
- var caseState = shareCases_1_1.value;
3170
- if (caseState.pendingShares && caseState.pendingShares.length > 0) {
3171
- isDisabled = false;
3172
- break;
3173
- }
3174
- if (caseState.pendingUnshares && caseState.pendingUnshares.length > 0) {
3175
- isDisabled = false;
3176
- break;
3177
- }
3178
- }
3179
- }
3180
- catch (e_1_1) {
3181
- e_1 = { error: e_1_1 };
3182
- }
3183
- finally {
3184
- try {
3185
- if (shareCases_1_1 && !shareCases_1_1.done && (_a = shareCases_1.return))
3186
- _a.call(shareCases_1);
3187
- }
3188
- finally {
3189
- if (e_1)
3190
- throw e_1.error;
3191
- }
3192
- }
3193
- }));
3194
- return isDisabled;
3195
- };
3196
3168
  /**
3197
3169
  * @param {?} sharedCase
3198
3170
  * @return {?}
@@ -3202,7 +3174,7 @@
3202
3174
  * @return {?}
3203
3175
  */
3204
3176
  function (sharedCase) {
3205
- var e_2, _a;
3177
+ var e_1, _a;
3206
3178
  if (sharedCase !== null) {
3207
3179
  /** @type {?} */
3208
3180
  var updated = [];
@@ -3214,8 +3186,8 @@
3214
3186
  }
3215
3187
  }
3216
3188
  }
3217
- catch (e_2_1) {
3218
- e_2 = { error: e_2_1 };
3189
+ catch (e_1_1) {
3190
+ e_1 = { error: e_1_1 };
3219
3191
  }
3220
3192
  finally {
3221
3193
  try {
@@ -3223,8 +3195,8 @@
3223
3195
  _a.call(_b);
3224
3196
  }
3225
3197
  finally {
3226
- if (e_2)
3227
- throw e_2.error;
3198
+ if (e_1)
3199
+ throw e_1.error;
3228
3200
  }
3229
3201
  }
3230
3202
  this.shareCases = updated;
@@ -3234,7 +3206,7 @@
3234
3206
  ShareCaseComponent.decorators = [
3235
3207
  { type: i0.Component, args: [{
3236
3208
  selector: 'xuilib-share-case',
3237
- template: "<div id=\"add-user\">\n <div class=\"govuk-form-group\">\n <label class=\"govuk-label govuk-!-font-weight-bold\" for=\"add-user-input\">{{addUserLabel}}</label>\n <span id=\"add-user-hint\" class=\"govuk-hint\">\n Search by name or email address. You can share access with as many people as you need.\n </span>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <xuilib-user-select\n id=\"add-user-input\"\n aria-describedby=\"add-user-hint\"\n [users]=\"users\"\n (selected)=\"onSelectedUser($event)\">\n </xuilib-user-select>\n </div>\n <div class=\"govuk-grid-column-one-thirds\">\n <button id=\"btn-add-user\" (click)=\"addUser()\" class=\"govuk-button\" [disabled]=\"isDisabledAdd()\" title=\"Add user to selected cases\">Add</button>\n </div>\n </div>\n <details id=\"add-user-help\" class=\"govuk-details\" data-module=\"govuk-details\">\n <summary class=\"govuk-details__summary\">\n <span id=\"content-why-can-not-find-email\" class=\"govuk-details__summary-text\">\n Can't find an email address?\n </span>\n </summary>\n <div id=\"content-reason-can-not-find-email\" class=\"govuk-details__text\">\n If you can't find your colleague's email address, they will need to complete their registration. Contact your\n administrator for help.\n </div>\n </details>\n </div>\n <div class=\"govuk-form-group\" *ngIf=\"showRemoveUsers\">\n <label class=\"govuk-label govuk-!-font-weight-bold\" for=\"remove-user-input\">Remove a person from all cases</label>\n <span id=\"remove-user-hint\" class=\"govuk-hint\">\n Select a person to remove them from all selected cases.\n </span>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <select class=\"govuk-select\" id=\"remove-user-input\" aria-describedby=\"remove-user-hint\">\n <option value=\"{{user}}\" *ngFor=\"let user of users\">{{user.email}}</option>\n </select>\n </div>\n <div class=\"govuk-grid-column-one-thirds\">\n <button id=\"btn-remove-user\" class=\"govuk-button\" title=\"Remove user from selected cases\">Remove</button>\n </div>\n </div>\n </div>\n</div>\n\n<div id=\"cases\">\n <h3 id=\"title-selected-cases\" class=\"govuk-heading-m\">Selected cases</h3>\n <div *ngIf=\"shareCases && shareCases.length > 0\" class=\"govuk-accordion\" data-module=\"govuk-accordion\" id=\"accordion-with-summary-sections\">\n <xuilib-selected-case-list\n [shareCases$]=\"shareCases$\"\n [removeUserFromCaseToggleOn]=\"removeUserFromCaseToggleOn\"\n (unselect)=\"onUnselect($event)\"\n (synchronizeStore)=\"onSynchronizeStore($event)\"\n >\n </xuilib-selected-case-list>\n </div>\n\n <div id=\"noCaseDisplay\" *ngIf=\"shareCases && shareCases.length === 0\" class=\"govuk-hint\">\n No cases to display.\n </div>\n\n</div>\n\n<div id=\"share-case-nav\" class=\"govuk-button-group\">\n <button class=\"govuk-button\" data-module=\"govuk-button\" [disabled]=\"isDisabledContinue()\" title=\"Continue\" [routerLink]=\"confirmLink\">Continue</button>\n <button class=\"govuk-button govuk-button--secondary\" data-module=\"govuk-button\" title=\"Cancel\">Cancel</button>\n</div>\n",
3209
+ template: "<xuilib-hmcts-error-summary\n [errorMessages]=\"validationErrors\"\n [header]=\"'There is a problem'\"\n></xuilib-hmcts-error-summary>\n<h1 *ngIf=\"title\" class=\"govuk-heading-xl govuk-!-margin-top-2\">\n <span *ngIf=\"fnTitle\" class=\"govuk-caption-xl\">{{fnTitle}}</span>\n {{title}}\n</h1>\n<div id=\"add-user\">\n <div class=\"govuk-form-group\">\n <label class=\"govuk-label govuk-!-font-weight-bold\" for=\"add-user-input\">{{addUserLabel}}</label>\n <span id=\"add-user-hint\" class=\"govuk-hint\">\n Search by name or email address. You can share access with as many people as you need.\n </span>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <xuilib-user-select\n id=\"add-user-input\"\n aria-describedby=\"add-user-hint\"\n [users]=\"users\"\n (selected)=\"onSelectedUser($event)\">\n </xuilib-user-select>\n </div>\n <div class=\"govuk-grid-column-one-thirds\">\n <button id=\"btn-add-user\" (click)=\"addUser()\" class=\"govuk-button govuk-button--secondary\" [disabled]=\"isDisabledAdd()\" title=\"Add user to selected cases\">Add</button>\n </div>\n </div>\n <details id=\"add-user-help\" class=\"govuk-details\" data-module=\"govuk-details\">\n <summary class=\"govuk-details__summary\">\n <span id=\"content-why-can-not-find-email\" class=\"govuk-details__summary-text\">\n Can't find an email address?\n </span>\n </summary>\n <div id=\"content-reason-can-not-find-email\" class=\"govuk-details__text\">\n If you can't find your colleague's email address, they will need to complete their registration. Contact your\n administrator for help.\n </div>\n </details>\n </div>\n <div class=\"govuk-form-group\" *ngIf=\"showRemoveUsers\">\n <label class=\"govuk-label govuk-!-font-weight-bold\" for=\"remove-user-input\">Remove a person from all cases</label>\n <span id=\"remove-user-hint\" class=\"govuk-hint\">\n Select a person to remove them from all selected cases.\n </span>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <select class=\"govuk-select\" id=\"remove-user-input\" aria-describedby=\"remove-user-hint\">\n <option value=\"{{user}}\" *ngFor=\"let user of users\">{{user.email}}</option>\n </select>\n </div>\n <div class=\"govuk-grid-column-one-thirds\">\n <button id=\"btn-remove-user\" class=\"govuk-button govuk-button--secondary\" title=\"Remove user from selected cases\">Remove</button>\n </div>\n </div>\n </div>\n</div>\n\n<div id=\"cases\" [ngClass]=\"{'govuk-form-group--error': shareCaseErrorMessage.length > 0}\">\n <p class=\"govuk-error-message\" *ngIf=\"validationErrors.length > 0\">\n <span class=\"govuk-visually-hidden\">Error:</span>{{shareCaseErrorMessage}}\n </p>\n <h3 id=\"title-selected-cases\" class=\"govuk-heading-m\">Selected cases</h3>\n <div *ngIf=\"shareCases && shareCases.length > 0\" class=\"govuk-accordion\" data-module=\"govuk-accordion\" id=\"accordion-with-summary-sections\">\n <xuilib-selected-case-list\n [shareCases$]=\"shareCases$\"\n [removeUserFromCaseToggleOn]=\"removeUserFromCaseToggleOn\"\n (unselect)=\"onUnselect($event)\"\n (synchronizeStore)=\"onSynchronizeStore($event)\"\n >\n </xuilib-selected-case-list>\n </div>\n\n <div id=\"noCaseDisplay\" *ngIf=\"shareCases && shareCases.length === 0\" class=\"govuk-hint\">\n No cases to display.\n </div>\n\n</div>\n\n<div id=\"share-case-nav\" class=\"govuk-button-group\">\n <button class=\"govuk-button\" data-module=\"govuk-button\" title=\"Continue\" [routerLink]=\"confirmLink\">Continue</button>\n <button class=\"govuk-button govuk-button--secondary\" data-module=\"govuk-button\" title=\"Cancel\">Cancel</button>\n</div>\n",
3238
3210
  styles: ["select{width:100%}"]
3239
3211
  }] }
3240
3212
  ];
@@ -3251,6 +3223,8 @@
3251
3223
  confirmLink: [{ type: i0.Input }],
3252
3224
  addUserLabel: [{ type: i0.Input }],
3253
3225
  showRemoveUsers: [{ type: i0.Input }],
3226
+ fnTitle: [{ type: i0.Input }],
3227
+ title: [{ type: i0.Input }],
3254
3228
  unselect: [{ type: i0.Output }],
3255
3229
  synchronizeStore: [{ type: i0.Output }],
3256
3230
  userSelect: [{ type: i0.ViewChild, args: [UserSelectComponent,] }]
@@ -3857,6 +3831,12 @@
3857
3831
  return RadioFilterFieldConfig;
3858
3832
  }());
3859
3833
 
3834
+ /**
3835
+ * @fileoverview added by tsickle
3836
+ * Generated from: lib/models/index.ts
3837
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3838
+ */
3839
+
3860
3840
  /**
3861
3841
  * @fileoverview added by tsickle
3862
3842
  * Generated from: lib/services/locations/location.service.ts
@@ -7848,6 +7828,7 @@
7848
7828
  exports.dateValidator = dateValidator;
7849
7829
  exports.radioGroupValidator = radioGroupValidator;
7850
7830
  exports.HmctsSubNavigationComponent = HmctsSubNavigationComponent;
7831
+ exports.SharedCaseErrorMessages = SharedCaseErrorMessages;
7851
7832
  exports.BadgeColour = BadgeColour;
7852
7833
  exports.DateBadgeColour = DateBadgeColour;
7853
7834
  exports.SECONDS_IN_A_DAY = SECONDS_IN_A_DAY;