@hmcts/rpx-xui-common-lib 1.4.10-search-location-component-common → 1.4.13-location-api-cr
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.
- package/bundles/hmcts-rpx-xui-common-lib.umd.js +105 -14
- package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/components/generic-filter/generic-filter.component.js +82 -3
- package/esm2015/lib/components/search-location/search-location.component.js +10 -8
- package/esm2015/lib/models/filter.model.js +1 -1
- package/esm2015/lib/models/location.model.js +49 -1
- package/esm2015/lib/services/locations/location.service.js +6 -5
- package/esm5/lib/components/generic-filter/generic-filter.component.js +89 -3
- package/esm5/lib/components/search-location/search-location.component.js +22 -16
- package/esm5/lib/models/filter.model.js +1 -1
- package/esm5/lib/models/location.model.js +49 -1
- package/esm5/lib/services/locations/location.service.js +16 -7
- package/fesm2015/hmcts-rpx-xui-common-lib.js +94 -12
- package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/fesm5/hmcts-rpx-xui-common-lib.js +123 -22
- package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
- package/lib/components/generic-filter/generic-filter.component.d.ts +5 -0
- package/lib/components/search-location/search-location.component.d.ts +9 -9
- package/lib/models/filter.model.d.ts +1 -0
- package/lib/models/location.model.d.ts +23 -0
- package/lib/services/locations/location.service.d.ts +9 -2
- package/package.json +1 -1
|
@@ -1093,6 +1093,7 @@
|
|
|
1093
1093
|
this._settings.fields = JSON.parse(JSON.stringify(this.config.cancelSetting.fields));
|
|
1094
1094
|
}
|
|
1095
1095
|
this.filterService.persist(this.settings, this.config.persistence);
|
|
1096
|
+
this.filterService.givenErrors.next(null);
|
|
1096
1097
|
};
|
|
1097
1098
|
/**
|
|
1098
1099
|
* @param {?} values
|
|
@@ -1130,6 +1131,85 @@
|
|
|
1130
1131
|
}
|
|
1131
1132
|
}
|
|
1132
1133
|
};
|
|
1134
|
+
/**
|
|
1135
|
+
* @param {?} event
|
|
1136
|
+
* @param {?} form
|
|
1137
|
+
* @param {?} item
|
|
1138
|
+
* @param {?} field
|
|
1139
|
+
* @return {?}
|
|
1140
|
+
*/
|
|
1141
|
+
GenericFilterComponent.prototype.toggleSelectAll = /**
|
|
1142
|
+
* @param {?} event
|
|
1143
|
+
* @param {?} form
|
|
1144
|
+
* @param {?} item
|
|
1145
|
+
* @param {?} field
|
|
1146
|
+
* @return {?}
|
|
1147
|
+
*/
|
|
1148
|
+
function (event, form, item, field) {
|
|
1149
|
+
/** @type {?} */
|
|
1150
|
+
var isChecked = event.target.checked;
|
|
1151
|
+
/** @type {?} */
|
|
1152
|
+
var formArray = ( /** @type {?} */(form.get(field.name)));
|
|
1153
|
+
if (!item.selectAll) {
|
|
1154
|
+
/** @type {?} */
|
|
1155
|
+
var allChecked = formArray.controls.every(( /**
|
|
1156
|
+
* @param {?} control
|
|
1157
|
+
* @return {?}
|
|
1158
|
+
*/function (control) { return control.value; }));
|
|
1159
|
+
/** @type {?} */
|
|
1160
|
+
var index_1 = null;
|
|
1161
|
+
/** @type {?} */
|
|
1162
|
+
var hasSelectAllOption = field.options.find(( /**
|
|
1163
|
+
* @param {?} option
|
|
1164
|
+
* @param {?} i
|
|
1165
|
+
* @return {?}
|
|
1166
|
+
*/function (option, i) {
|
|
1167
|
+
if (option.hasOwnProperty('selectAll')) {
|
|
1168
|
+
index_1 = i;
|
|
1169
|
+
return true;
|
|
1170
|
+
}
|
|
1171
|
+
return false;
|
|
1172
|
+
}));
|
|
1173
|
+
// tslint:disable-next-line:variable-name
|
|
1174
|
+
/** @type {?} */
|
|
1175
|
+
var isAllCheckedExcludingTheSelectAllOption = formArray.controls.filter(( /**
|
|
1176
|
+
* @param {?} _control
|
|
1177
|
+
* @param {?} i
|
|
1178
|
+
* @return {?}
|
|
1179
|
+
*/function (_control, i) { return i !== index_1; }))
|
|
1180
|
+
.every(( /**
|
|
1181
|
+
* @param {?} control
|
|
1182
|
+
* @return {?}
|
|
1183
|
+
*/function (control) { return control.value; }));
|
|
1184
|
+
if (!allChecked && hasSelectAllOption && !isChecked) {
|
|
1185
|
+
formArray.controls.forEach(( /**
|
|
1186
|
+
* @param {?} control
|
|
1187
|
+
* @param {?} i
|
|
1188
|
+
* @return {?}
|
|
1189
|
+
*/function (control, i) {
|
|
1190
|
+
if (index_1 === i) {
|
|
1191
|
+
control.patchValue(false);
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
}));
|
|
1195
|
+
}
|
|
1196
|
+
else if (hasSelectAllOption && !allChecked && isChecked && isAllCheckedExcludingTheSelectAllOption) {
|
|
1197
|
+
formArray.controls[index_1].patchValue(true);
|
|
1198
|
+
}
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
formArray.controls.forEach(( /**
|
|
1202
|
+
* @param {?} control
|
|
1203
|
+
* @return {?}
|
|
1204
|
+
*/function (control) {
|
|
1205
|
+
if (isChecked) {
|
|
1206
|
+
control.patchValue(true);
|
|
1207
|
+
}
|
|
1208
|
+
else {
|
|
1209
|
+
control.patchValue(false);
|
|
1210
|
+
}
|
|
1211
|
+
}));
|
|
1212
|
+
};
|
|
1133
1213
|
/**
|
|
1134
1214
|
* @private
|
|
1135
1215
|
* @param {?} filter
|
|
@@ -1409,10 +1489,10 @@
|
|
|
1409
1489
|
GenericFilterComponent.decorators = [
|
|
1410
1490
|
{ type: i0.Component, args: [{
|
|
1411
1491
|
selector: 'xuilib-generic-filter',
|
|
1412
|
-
template: "<form [formGroup]=\"form\" (ngSubmit)=\"applyFilter(form)\">\n <div class=\"contain-classes\" *ngFor=\"let field of config.fields\">\n <hr *ngIf=\"field.lineBreakBefore\" class=\"govuk-section-break govuk-section-break--visible elevated-break\">\n <div class=\"govuk-form-group xui-generic-filter\"\n [hidden]=\"hidden(field, form)\"\n [ngClass]=\"{'form-group-error': submitted && (form.get(field.name).errors?.minLength || form.get(field.name).errors?.maxLength)}\">\n <h3 *ngIf=\"field.title\" class=\"govuk-heading-s\">{{field.title}}</h3>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <div class=\"govuk-body\" [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'select'\">\n <select class=\"govuk-select\" (change)=\"selectChanged(field, form)\" [attr.disabled]=\"disabled(field, form)\" [name]=\"'select_' + field.name\" [id]=\"'select_' + field.name\" [formControlName]=\"field.name\">\n <option disabled selected hidden value=\"\">{{field.disabledText}}</option>\n <option class=\"govuk-radios__item\" *ngFor=\"let item of field.options\" [value]=\"item.key\">{{item.label}}</option>\n </select>\n </ng-container>\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div class=\"govuk-checkboxes govuk-checkboxes--small\" [formGroupName]=\"field.name\">\n <div *ngFor=\"let item of field.options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" class=\"govuk-checkboxes__input\"\n [attr.disabled]=\"disabled(field, form)\"\n [formControlName]=\"i\"\n [value]=\"item.key\" [id]=\"'checkbox_' + item.key\"\n [name]=\"'checkbox_' + item.key\"\n />\n <label
|
|
1492
|
+
template: "<form [formGroup]=\"form\" (ngSubmit)=\"applyFilter(form)\">\n <div class=\"contain-classes\" *ngFor=\"let field of config.fields\">\n <hr *ngIf=\"field.lineBreakBefore\" class=\"govuk-section-break govuk-section-break--visible elevated-break\">\n <div class=\"govuk-form-group xui-generic-filter\"\n [hidden]=\"hidden(field, form)\"\n [ngClass]=\"{'form-group-error': submitted && (form.get(field.name).errors?.minLength || form.get(field.name).errors?.maxLength)}\">\n <h3 *ngIf=\"field.title\" class=\"govuk-heading-s\">{{field.title}}</h3>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMinSelectedError && submitted && form.get(field.name).errors?.minLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n <div class=\"govuk-body\" [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'select'\">\n <select class=\"govuk-select\" (change)=\"selectChanged(field, form)\" [attr.disabled]=\"disabled(field, form)\" [name]=\"'select_' + field.name\" [id]=\"'select_' + field.name\" [formControlName]=\"field.name\">\n <option disabled selected hidden value=\"\">{{field.disabledText}}</option>\n <option class=\"govuk-radios__item\" *ngFor=\"let item of field.options\" [value]=\"item.key\">{{item.label}}</option>\n </select>\n </ng-container>\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div class=\"govuk-checkboxes govuk-checkboxes--small\" [formGroupName]=\"field.name\" [attr.field]=\"field.name\" [id]=\"'checkbox_' + field.name\">\n <div *ngFor=\"let item of field.options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" class=\"govuk-checkboxes__input\"\n [attr.disabled]=\"disabled(field, form)\"\n [formControlName]=\"i\"\n (change)=\"toggleSelectAll($event, form, item, field)\"\n [value]=\"item.key\" [id]=\"'checkbox_' + item.key\"\n [name]=\"'checkbox_' + item.key\"\n />\n <label\n [for]=\"'checkbox_' + item.key\"\n class=\"govuk-label govuk-checkboxes__label\"\n [ngClass]=\"{'govuk-!-font-weight-bold': item.selectAll}\"\n >{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'radio'\">\n <div class=\"govuk-radios\">\n <div *ngFor=\"let item of field.options\" class=\"govuk-radios__item\">\n <input type=\"radio\"\n [formControlName]=\"field.name\"\n [id]=\"'radio_' + item.key\"\n [attr.disabled]=\"disabled(field, form)\"\n [checked]=\"item.key === form.get(field.name).value\"\n class=\"govuk-radios__input\"\n [value]=\"item.key\"\n (change)=\"radiosChanged(field)\"\n />\n <label [for]=\"'radio_' + item.key\" class=\"govuk-label govuk-radios__label\">{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-person'\">\n <xuilib-find-person subTitle=\"\" (personSelected)=\"updatePersonControls($event, field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"field.domain\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n ></xuilib-find-person>\n </ng-container>\n </div>\n </div>\n </div>\n <hr class=\"govuk-section-break govuk-section-break--m govuk-section-break--visible\"/>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-full\">\n <button\n class=\"govuk-button govuk-!-margin-right-1 govuk-!-margin-bottom-0\"\n type=\"submit\"\n id=\"applyFilter\"\n [disabled]=\"config.enableDisabledButton && form.invalid\"\n >{{config.applyButtonText || 'Apply'}}</button>\n <button\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\"\n type=\"button\"\n id=\"cancelFilter\"\n (click)=\"cancelFilter()\">{{ config.cancelButtonText || 'Cancel'}}</button>\n </div>\n </div>\n</form>\n",
|
|
1413
1493
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1414
1494
|
encapsulation: i0.ViewEncapsulation.None,
|
|
1415
|
-
styles: [".contain-classes .elevated-break{position:relative;top:-10px}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0
|
|
1495
|
+
styles: [".contain-classes .elevated-break{position:relative;top:-10px}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0}"]
|
|
1416
1496
|
}] }
|
|
1417
1497
|
];
|
|
1418
1498
|
/** @nocollapse */
|
|
@@ -3509,19 +3589,28 @@
|
|
|
3509
3589
|
this.http = http;
|
|
3510
3590
|
}
|
|
3511
3591
|
/**
|
|
3512
|
-
* @
|
|
3592
|
+
* @description getAllLocations from service Ids/location type/search term
|
|
3593
|
+
* @param serviceIds: SSCS | SSCS,IA split with ','
|
|
3594
|
+
* @param locationType: optional | hearing | case_management
|
|
3595
|
+
* @param searchTerm: any search term for postcode | site name | venue name |court name | court address etc.
|
|
3596
|
+
* @return Observable<LocationByEPIMSModel[]>: Array of locationModel in Observable
|
|
3597
|
+
*/
|
|
3598
|
+
/**
|
|
3599
|
+
* \@description getAllLocations from service Ids/location type/search term
|
|
3600
|
+
* @param {?} serviceIds
|
|
3513
3601
|
* @param {?} locationType
|
|
3514
3602
|
* @param {?} searchTerm
|
|
3515
|
-
* @return {?}
|
|
3603
|
+
* @return {?} Observable<LocationByEPIMSModel[]>: Array of locationModel in Observable
|
|
3516
3604
|
*/
|
|
3517
3605
|
LocationService.prototype.getAllLocations = /**
|
|
3518
|
-
*
|
|
3606
|
+
* \@description getAllLocations from service Ids/location type/search term
|
|
3607
|
+
* @param {?} serviceIds
|
|
3519
3608
|
* @param {?} locationType
|
|
3520
3609
|
* @param {?} searchTerm
|
|
3521
|
-
* @return {?}
|
|
3610
|
+
* @return {?} Observable<LocationByEPIMSModel[]>: Array of locationModel in Observable
|
|
3522
3611
|
*/
|
|
3523
|
-
function (
|
|
3524
|
-
return this.http.get("api/locations/getLocations?
|
|
3612
|
+
function (serviceIds, locationType, searchTerm) {
|
|
3613
|
+
return this.http.get("api/locations/getLocations?serviceIds=" + serviceIds + "&locationType=" + locationType + "&searchTerm=" + searchTerm);
|
|
3525
3614
|
};
|
|
3526
3615
|
LocationService.decorators = [
|
|
3527
3616
|
{ type: i0.Injectable, args: [{
|
|
@@ -3546,7 +3635,9 @@
|
|
|
3546
3635
|
var SearchLocationComponent = /** @class */ (function () {
|
|
3547
3636
|
function SearchLocationComponent(locationService, fb) {
|
|
3548
3637
|
this.locationService = locationService;
|
|
3549
|
-
|
|
3638
|
+
// i.e. serviceIds = SSCS or serviceIds = SSCS,IA,EMPLOYMENT etc.
|
|
3639
|
+
this.serviceIds = '';
|
|
3640
|
+
// i.e. locationType = optional or hearing or case_management
|
|
3550
3641
|
this.locationType = '';
|
|
3551
3642
|
this.disabled = null;
|
|
3552
3643
|
this.submitted = true;
|
|
@@ -3598,7 +3689,7 @@
|
|
|
3598
3689
|
return !selectedLocations.map(( /**
|
|
3599
3690
|
* @param {?} selectedLocation
|
|
3600
3691
|
* @return {?}
|
|
3601
|
-
*/function (selectedLocation) { return selectedLocation.
|
|
3692
|
+
*/function (selectedLocation) { return selectedLocation.epims_id; })).includes(apiLocation.epims_id);
|
|
3602
3693
|
}));
|
|
3603
3694
|
})));
|
|
3604
3695
|
}))).subscribe(( /**
|
|
@@ -3642,7 +3733,7 @@
|
|
|
3642
3733
|
* @return {?}
|
|
3643
3734
|
*/
|
|
3644
3735
|
function (term) {
|
|
3645
|
-
return this.locationService.getAllLocations(this.
|
|
3736
|
+
return this.locationService.getAllLocations(this.serviceIds, this.locationType, term);
|
|
3646
3737
|
};
|
|
3647
3738
|
/**
|
|
3648
3739
|
* @return {?}
|
|
@@ -3681,7 +3772,7 @@
|
|
|
3681
3772
|
var index = selectedLocations.findIndex(( /**
|
|
3682
3773
|
* @param {?} selectedLocation
|
|
3683
3774
|
* @return {?}
|
|
3684
|
-
*/function (selectedLocation) { return selectedLocation.
|
|
3775
|
+
*/function (selectedLocation) { return selectedLocation.epims_id === location.epims_id; }));
|
|
3685
3776
|
selectedLocations.splice(index, 1);
|
|
3686
3777
|
}));
|
|
3687
3778
|
};
|
|
@@ -3694,7 +3785,7 @@
|
|
|
3694
3785
|
* @return {?}
|
|
3695
3786
|
*/
|
|
3696
3787
|
function (selectedLocation) {
|
|
3697
|
-
return selectedLocation.
|
|
3788
|
+
return selectedLocation.court_name;
|
|
3698
3789
|
};
|
|
3699
3790
|
SearchLocationComponent.decorators = [
|
|
3700
3791
|
{ type: i0.Component, args: [{
|
|
@@ -3711,7 +3802,7 @@
|
|
|
3711
3802
|
];
|
|
3712
3803
|
};
|
|
3713
3804
|
SearchLocationComponent.propDecorators = {
|
|
3714
|
-
|
|
3805
|
+
serviceIds: [{ type: i0.Input }],
|
|
3715
3806
|
locationType: [{ type: i0.Input }],
|
|
3716
3807
|
disabled: [{ type: i0.Input }],
|
|
3717
3808
|
selectedLocations$: [{ type: i0.Input }],
|