@hmcts/rpx-xui-common-lib 1.7.45 → 1.7.47-clear-stream-data-v2

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 (49) hide show
  1. package/bundles/hmcts-rpx-xui-common-lib.umd.js +382 -55
  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 +3 -2
  6. package/esm2015/lib/components/find-location/find-location.component.js +2 -2
  7. package/esm2015/lib/components/find-service/find-service.component.js +128 -27
  8. package/esm2015/lib/components/generic-filter/generic-filter-utils.js +1 -1
  9. package/esm2015/lib/components/generic-filter/generic-filter.component.js +150 -11
  10. package/esm2015/lib/components/search-location/search-location.component.js +2 -2
  11. package/esm2015/lib/components/search-service/search-service.component.js +16 -33
  12. package/esm2015/lib/exui-common-lib.module.js +10 -3
  13. package/esm2015/lib/models/filter.model.js +53 -3
  14. package/esm2015/lib/pipes/capitalize.pipe.js +21 -0
  15. package/esm2015/lib/services/filter/filter.service.js +19 -5
  16. package/esm2015/lib/services/find-person/find-person.service.js +3 -3
  17. package/esm2015/lib/services/storage/session-storage/session-storage.service.js +55 -0
  18. package/esm5/hmcts-rpx-xui-common-lib.js +3 -2
  19. package/esm5/lib/components/find-location/find-location.component.js +2 -2
  20. package/esm5/lib/components/find-service/find-service.component.js +166 -25
  21. package/esm5/lib/components/generic-filter/generic-filter-utils.js +1 -1
  22. package/esm5/lib/components/generic-filter/generic-filter.component.js +166 -10
  23. package/esm5/lib/components/search-location/search-location.component.js +2 -2
  24. package/esm5/lib/components/search-service/search-service.component.js +18 -37
  25. package/esm5/lib/exui-common-lib.module.js +8 -3
  26. package/esm5/lib/models/filter.model.js +53 -3
  27. package/esm5/lib/pipes/capitalize.pipe.js +29 -0
  28. package/esm5/lib/services/filter/filter.service.js +23 -5
  29. package/esm5/lib/services/find-person/find-person.service.js +3 -3
  30. package/esm5/lib/services/{session-storage → storage/session-storage}/session-storage.service.js +2 -2
  31. package/fesm2015/hmcts-rpx-xui-common-lib.js +331 -54
  32. package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
  33. package/fesm5/hmcts-rpx-xui-common-lib.js +395 -55
  34. package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
  35. package/hmcts-rpx-xui-common-lib.d.ts +2 -1
  36. package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
  37. package/lib/components/find-service/find-service.component.d.ts +15 -9
  38. package/lib/components/generic-filter/generic-filter-utils.d.ts +2 -5
  39. package/lib/components/generic-filter/generic-filter.component.d.ts +6 -2
  40. package/lib/components/search-location/search-location.component.d.ts +1 -1
  41. package/lib/components/search-service/search-service.component.d.ts +5 -11
  42. package/lib/exui-common-lib.module.d.ts +1 -2
  43. package/lib/models/filter.model.d.ts +24 -7
  44. package/lib/pipes/capitalize.pipe.d.ts +4 -0
  45. package/lib/services/filter/filter.service.d.ts +1 -0
  46. package/lib/services/find-person/find-person.service.d.ts +1 -1
  47. package/lib/services/{session-storage → storage/session-storage}/session-storage.service.d.ts +0 -0
  48. package/package.json +1 -1
  49. package/esm2015/lib/services/session-storage/session-storage.service.js +0 -55
@@ -10,7 +10,7 @@ import { Title } from '@angular/platform-browser';
10
10
  import { DocumentInterruptSource, Idle } from '@ng-idle/core';
11
11
  import { Keepalive } from '@ng-idle/keepalive';
12
12
  import { RouterModule, Router, NavigationEnd } from '@angular/router';
13
- import { Component, EventEmitter, Input, Output, ViewEncapsulation, Injectable, Directive, TemplateRef, ViewContainerRef, ElementRef, Inject, ViewChild, ChangeDetectorRef, InjectionToken, defineInjectable, inject, NgModule, ChangeDetectionStrategy } from '@angular/core';
13
+ import { Component, EventEmitter, Input, Output, ViewEncapsulation, Injectable, Directive, TemplateRef, ViewContainerRef, ElementRef, Pipe, Inject, ViewChild, ChangeDetectorRef, InjectionToken, defineInjectable, inject, NgModule, ChangeDetectionStrategy } from '@angular/core';
14
14
  import { BehaviorSubject, of, zip, Subject, combineLatest } from 'rxjs';
15
15
  import { distinctUntilChanged, map, debounceTime, filter, mergeMap, tap, catchError, switchMap, delay, skipWhile } from 'rxjs/operators';
16
16
 
@@ -662,10 +662,10 @@ var FilterService = /** @class */ (function () {
662
662
  return this.filterSettings[id];
663
663
  }
664
664
  if (sessionStorage.getItem(id)) {
665
- return JSON.parse(window.sessionStorage.getItem(id));
665
+ return JSON.parse(sessionStorage.getItem(id));
666
666
  }
667
667
  if (localStorage.getItem(id)) {
668
- return JSON.parse(window.localStorage.getItem(id));
668
+ return JSON.parse(localStorage.getItem(id));
669
669
  }
670
670
  return null;
671
671
  };
@@ -683,6 +683,24 @@ var FilterService = /** @class */ (function () {
683
683
  }
684
684
  return this.streams[id].asObservable();
685
685
  };
686
+ /**
687
+ * @param {?} id
688
+ * @return {?}
689
+ */
690
+ FilterService.prototype.clearSessionAndLocalPersistance = /**
691
+ * @param {?} id
692
+ * @return {?}
693
+ */
694
+ function (id) {
695
+ sessionStorage.removeItem(id);
696
+ localStorage.removeItem(id);
697
+ if (this.filterSettings[id] !== undefined) {
698
+ this.filterSettings[id] = null;
699
+ }
700
+ if (this.streams[id] !== undefined) {
701
+ this.streams[id].next(null);
702
+ }
703
+ };
686
704
  /**
687
705
  * @private
688
706
  * @param {?} setting
@@ -694,7 +712,7 @@ var FilterService = /** @class */ (function () {
694
712
  * @return {?}
695
713
  */
696
714
  function (setting) {
697
- window.localStorage.setItem(setting.id, JSON.stringify(setting));
715
+ localStorage.setItem(setting.id, JSON.stringify(setting));
698
716
  };
699
717
  /**
700
718
  * @private
@@ -707,7 +725,7 @@ var FilterService = /** @class */ (function () {
707
725
  * @return {?}
708
726
  */
709
727
  function (setting) {
710
- window.sessionStorage.setItem(setting.id, JSON.stringify(setting));
728
+ sessionStorage.setItem(setting.id, JSON.stringify(setting));
711
729
  };
712
730
  /**
713
731
  * @private
@@ -880,10 +898,10 @@ var GenericFilterComponent = /** @class */ (function () {
880
898
  function (field) {
881
899
  /** @type {?} */
882
900
  var validators = [];
883
- if (field && field.minSelected) {
901
+ if (field && field.minSelected > 0) {
884
902
  validators.push(minSelectedValidator(field.minSelected));
885
903
  }
886
- if (field && field.maxSelected) {
904
+ if (field && field.maxSelected > 0) {
887
905
  validators.push(maxSelectedValidator(field.maxSelected));
888
906
  }
889
907
  return validators;
@@ -905,6 +923,7 @@ var GenericFilterComponent = /** @class */ (function () {
905
923
  * @return {?}
906
924
  */
907
925
  function () { return _this.submitted = false; }));
926
+ this.filterSkillsByServices(null, this.config);
908
927
  };
909
928
  /**
910
929
  * @return {?}
@@ -1078,6 +1097,11 @@ var GenericFilterComponent = /** @class */ (function () {
1078
1097
  * @return {?}
1079
1098
  */
1080
1099
  function (field) {
1100
+ if (field.name === 'user-services') {
1101
+ /** @type {?} */
1102
+ var selectedServices = this.getSelectedValuesForFields(this.form.controls, field);
1103
+ this.filterSkillsByServices(selectedServices, this.config);
1104
+ }
1081
1105
  if (field.radioSelectionChange && typeof field.radioSelectionChange === 'string') {
1082
1106
  var _a = __read(field.enableCondition.split('='), 2), name_3 = _a[0], value = _a[1];
1083
1107
  this.form.get(name_3).patchValue(value);
@@ -1099,6 +1123,9 @@ var GenericFilterComponent = /** @class */ (function () {
1099
1123
  this.filterService.persist(settings, this.config.persistence);
1100
1124
  this.filterService.givenErrors.next(null);
1101
1125
  this.submitted = false;
1126
+ if (this.config.cancelButtonCallback) {
1127
+ this.config.cancelButtonCallback();
1128
+ }
1102
1129
  };
1103
1130
  /**
1104
1131
  * @param {?} values
@@ -1351,9 +1378,9 @@ var GenericFilterComponent = /** @class */ (function () {
1351
1378
  var formArray = this_1.buildCheckBoxFormArray(field, settings);
1352
1379
  this_1.form.addControl(field.name, formArray);
1353
1380
  }
1354
- else if (field.type === 'find-location') {
1381
+ else if (field.type === 'find-location' || field.type === 'find-service') {
1355
1382
  /** @type {?} */
1356
- var formArray = this_1.buildFindLocationFormArray(field, settings);
1383
+ var formArray = this_1.buildFormArray(field, settings);
1357
1384
  this_1.form.addControl(field.name, formArray);
1358
1385
  }
1359
1386
  else {
@@ -1364,6 +1391,9 @@ var GenericFilterComponent = /** @class */ (function () {
1364
1391
  if (field.type === 'text-input') {
1365
1392
  validators.push(Validators.minLength(field.minSelected));
1366
1393
  }
1394
+ if (field.type === 'email-input') {
1395
+ validators.push(Validators.email);
1396
+ }
1367
1397
  }
1368
1398
  /** @type {?} */
1369
1399
  var defaultValue = null;
@@ -1397,7 +1427,7 @@ var GenericFilterComponent = /** @class */ (function () {
1397
1427
  });
1398
1428
  this_1.form.addControl(field.name, formGroup);
1399
1429
  }
1400
- else {
1430
+ else if (field.type !== 'group-title') {
1401
1431
  /** @type {?} */
1402
1432
  var control = new FormControl(defaultValue, validators);
1403
1433
  this_1.form.addControl(field.name, control);
@@ -1483,7 +1513,7 @@ var GenericFilterComponent = /** @class */ (function () {
1483
1513
  * @param {?} settings
1484
1514
  * @return {?}
1485
1515
  */
1486
- GenericFilterComponent.prototype.buildFindLocationFormArray = /**
1516
+ GenericFilterComponent.prototype.buildFormArray = /**
1487
1517
  * @private
1488
1518
  * @param {?} field
1489
1519
  * @param {?} settings
@@ -1579,7 +1609,7 @@ var GenericFilterComponent = /** @class */ (function () {
1579
1609
  var field = _c.value;
1580
1610
  /** @type {?} */
1581
1611
  var formGroup = form.get(field.name);
1582
- if (formGroup && formGroup.errors && formGroup.errors.minlength) {
1612
+ if (formGroup && formGroup.errors && (formGroup.errors.minlength || formGroup.errors.required)) {
1583
1613
  errors.push({ name: field.name, error: field.minSelectedError });
1584
1614
  }
1585
1615
  if (formGroup && formGroup.errors && formGroup.errors.maxLength) {
@@ -1594,17 +1624,159 @@ var GenericFilterComponent = /** @class */ (function () {
1594
1624
  }
1595
1625
  finally { if (e_8) throw e_8.error; }
1596
1626
  }
1627
+ // remove duplicates
1628
+ errors = errors.filter((/**
1629
+ * @param {?} filterError
1630
+ * @param {?} i
1631
+ * @param {?} arr
1632
+ * @return {?}
1633
+ */
1634
+ function (filterError, i, arr) {
1635
+ return errors.indexOf(arr.find((/**
1636
+ * @param {?} item
1637
+ * @return {?}
1638
+ */
1639
+ function (item) { return item.name === filterError.name; }))) === i;
1640
+ }));
1597
1641
  if (errors.length) {
1598
1642
  this.filterService.givenErrors.next(errors);
1599
1643
  }
1600
1644
  };
1645
+ /**
1646
+ * @param {?} services
1647
+ * @param {?} config
1648
+ * @return {?}
1649
+ */
1650
+ GenericFilterComponent.prototype.filterSkillsByServices = /**
1651
+ * @param {?} services
1652
+ * @param {?} config
1653
+ * @return {?}
1654
+ */
1655
+ function (services, config) {
1656
+ var _this = this;
1657
+ this.filteredSkillsByServices = [];
1658
+ /** @type {?} */
1659
+ var userSkillsField = config.fields.find((/**
1660
+ * @param {?} f
1661
+ * @return {?}
1662
+ */
1663
+ function (f) { return f.name === 'user-skills'; }));
1664
+ if (userSkillsField) {
1665
+ /** @type {?} */
1666
+ var userSkills_1 = userSkillsField.groupOptions;
1667
+ if (!services || services.length === 0) {
1668
+ this.filteredSkillsByServices = userSkills_1;
1669
+ }
1670
+ else {
1671
+ services.forEach((/**
1672
+ * @param {?} s
1673
+ * @return {?}
1674
+ */
1675
+ function (s) {
1676
+ /** @type {?} */
1677
+ var groupOption = userSkills_1.find((/**
1678
+ * @param {?} u
1679
+ * @return {?}
1680
+ */
1681
+ function (u) { return u.group === s; }));
1682
+ if (groupOption) {
1683
+ _this.filteredSkillsByServices.push(groupOption);
1684
+ }
1685
+ }));
1686
+ }
1687
+ }
1688
+ this.filteredSkillsByServices = this.sortGroupOptions(this.filteredSkillsByServices);
1689
+ return this.filteredSkillsByServices;
1690
+ };
1691
+ /**
1692
+ * @private
1693
+ * @param {?} formValues
1694
+ * @param {?} field
1695
+ * @return {?}
1696
+ */
1697
+ GenericFilterComponent.prototype.getSelectedValuesForFields = /**
1698
+ * @private
1699
+ * @param {?} formValues
1700
+ * @param {?} field
1701
+ * @return {?}
1702
+ */
1703
+ function (formValues, field) {
1704
+ /** @type {?} */
1705
+ var selectedValues = [];
1706
+ Object.keys(formValues).map((/**
1707
+ * @param {?} name
1708
+ * @return {?}
1709
+ */
1710
+ function (name) {
1711
+ /** @type {?} */
1712
+ var values = formValues[name].value;
1713
+ if (name === field.name) {
1714
+ values.forEach((/**
1715
+ * @param {?} v
1716
+ * @return {?}
1717
+ */
1718
+ function (v) {
1719
+ selectedValues.push(v.key);
1720
+ }));
1721
+ }
1722
+ }));
1723
+ return selectedValues;
1724
+ };
1725
+ /**
1726
+ * @private
1727
+ * @param {?} groupOptions
1728
+ * @return {?}
1729
+ */
1730
+ GenericFilterComponent.prototype.sortGroupOptions = /**
1731
+ * @private
1732
+ * @param {?} groupOptions
1733
+ * @return {?}
1734
+ */
1735
+ function (groupOptions) {
1736
+ /** @type {?} */
1737
+ var sortedResults = [];
1738
+ /** @type {?} */
1739
+ var groups = groupOptions.map((/**
1740
+ * @param {?} go
1741
+ * @return {?}
1742
+ */
1743
+ function (go) { return go.group; }));
1744
+ groups.sort().forEach((/**
1745
+ * @param {?} g
1746
+ * @return {?}
1747
+ */
1748
+ function (g) {
1749
+ /** @type {?} */
1750
+ var options = groupOptions.find((/**
1751
+ * @param {?} go
1752
+ * @return {?}
1753
+ */
1754
+ function (go) { return go.group === g; })).options;
1755
+ /** @type {?} */
1756
+ var sortedOptions = options.sort((/**
1757
+ * @param {?} a
1758
+ * @param {?} b
1759
+ * @return {?}
1760
+ */
1761
+ function (a, b) {
1762
+ return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : (b.label.toLowerCase() > a.label.toLowerCase() ? -1 : 0);
1763
+ }));
1764
+ /** @type {?} */
1765
+ var result = {
1766
+ group: g,
1767
+ options: sortedOptions
1768
+ };
1769
+ sortedResults.push(result);
1770
+ }));
1771
+ return sortedResults;
1772
+ };
1601
1773
  GenericFilterComponent.decorators = [
1602
1774
  { type: Component, args: [{
1603
1775
  selector: 'xuilib-generic-filter',
1604
- 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 [id]=\"field.name\"\n [ngClass]=\"{'form-group-error': submitted && ((form.get(field.name).errors?.minlength || form.get(field.name).errors?.required) || 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 || form.get(field.name).errors?.required)\">\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)=\"fieldChanged(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=\"'checkbox-large'\">\n <div class=\"govuk-checkboxes\" [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)=\"fieldChanged(field, form)\"\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 (personFieldChanged)=\"inputChanged(field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"form.get(field.domainField)?.value\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n [userIncluded]=\"false\"\n ></xuilib-find-person>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-location'\">\n <xuilib-find-location (locationFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [fields]=\"config.fields\"\n [locationTitle]=\"field.locationTitle\"\n [enableAddLocationButton]=\"field.enableAddButton\"\n [disabled]=\"disabled(field, form)\"\n [disableInputField]=\"field.disable\"\n [selectedLocations]=\"form.get(field.name)?.value\"\n [submitted]=\"submitted\"\n [services]=\"form.get(field.findLocationField)?.value\"\n [field]=\"field\"\n ></xuilib-find-location>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-service'\">\n <xuilib-find-service (serviceFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [fields]=\"config.fields\"\n [title]=\"field.title\"\n [enableAddServiceButton]=\"field.enableAddButton\"\n [disabled]=\"disabled(field, form)\"\n [disableInputField]=\"field.disable\"\n [selectedServices]=\"form.get(field.name)?.value\"\n [field]=\"field\"\n ></xuilib-find-service>\n </ng-container>\n <ng-container *ngSwitchCase=\"'text-input'\">\n <input class=\"govuk-input\" type=\"text\"\n [formControlName]=\"field.name\"\n [id]=\"field.name\"\n [attr.disabled]=\"disabled(field, form)\"\n (change)=\"fieldChanged(field, form)\"\n />\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 *ngIf=\"config.showCancelFilterButton\"\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",
1776
+ 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 elevated-break\">\n <ng-container [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'group-title'\">\n <div [class]=\"field.titleClasses ? field.titleClasses: 'govuk-label govuk-label--m govuk-!-margin-bottom-4'\">\n {{ field.name | capitalize }}\n </div>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <div class=\"govuk-form-group xui-generic-filter\"\n [hidden]=\"hidden(field, form)\"\n [id]=\"field.name\"\n [ngClass]=\"{'form-group-error': submitted && ((form.get(field.name).errors?.minlength || form.get(field.name).errors?.required) || form.get(field.name).errors?.maxLength || form.get(field.name).errors?.email)}\">\n\n <div *ngIf=\"field.title\" class=\"xui-generic-filter__field-title\">\n <h3 [class]=\"field.titleClasses ? field.titleClasses : 'govuk-heading-s'\" style=\"margin-bottom: 0!important\">\n {{field.title | capitalize}}\n </h3>\n\n <div *ngIf=\"field?.titleHint\" class=\"govuk-!-margin-left-2\">\n {{ field.titleHint }}\n </div>\n </div>\n\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\"\n *ngIf=\"field.displayMinSelectedError && submitted && (form.get(field.name).errors?.minlength || form.get(field.name).errors?.required)\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\"\n *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\"\n *ngIf=\"field.emailError && submitted && form.get(field.name).errors?.email\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.emailError}}\n </span>\n\n <div class=\"govuk-body\" [class.govuk-body--maxWidth480px]=\"field.maxWidth480px\" [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'select'\">\n <select class=\"govuk-select\" (change)=\"fieldChanged(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=\"'group-select'\">\n <select class=\"govuk-select\" (change)=\"fieldChanged(field, form)\" [attr.disabled]=\"disabled(field, form)\" [name]=\"'select_' + field.name\" [id]=\"'select_' + field.name\" [formControlName]=\"field.name\">\n <option selected value=\"\">{{field.disabledText}}</option>\n <optgroup *ngFor = 'let grp of filteredSkillsByServices' label=\"{{grp.group | titlecase}}\">\n <option *ngFor = 'let item of grp.options' [value]=\"item.key\">{{item.label}}</option> \n </optgroup>\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=\"'checkbox-large'\">\n <div class=\"govuk-checkboxes\" [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)=\"fieldChanged(field, form)\"\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 (personFieldChanged)=\"inputChanged(field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"form.get(field.domainField)?.value\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n [userIncluded]=\"false\"\n ></xuilib-find-person>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-location'\">\n <xuilib-find-location (locationFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [fields]=\"config.fields\"\n [locationTitle]=\"field.locationTitle\"\n [enableAddLocationButton]=\"field.enableAddButton\"\n [disabled]=\"disabled(field, form)\"\n [disableInputField]=\"field.disable\"\n [selectedLocations]=\"form.get(field.name)?.value\"\n [submitted]=\"submitted\"\n [services]=\"form.get(field.findLocationField)?.value\"\n [field]=\"field\"\n ></xuilib-find-location>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-service'\">\n <xuilib-find-service (serviceFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [enableAddServiceButton]=\"field.enableAddButton\"\n [disabled]=\"disabled(field, form)\"\n [selectedServices]=\"form.get(field.name)?.value\"\n [services]=\"field.options\"\n [field]=\"field\"\n ></xuilib-find-service>\n </ng-container>\n <ng-container *ngSwitchCase=\"'text-input'\">\n <input class=\"govuk-input\" type=\"text\"\n [formControlName]=\"field.name\"\n [id]=\"field.name\"\n [attr.disabled]=\"disabled(field, form)\"\n (change)=\"fieldChanged(field, form)\"\n />\n </ng-container>\n <ng-container *ngSwitchCase=\"'email-input'\">\n <input class=\"govuk-input\" type=\"email\"\n [formControlName]=\"field.name\"\n [id]=\"field.name\"\n [attr.disabled]=\"disabled(field, form)\"\n (change)=\"fieldChanged(field, form)\"\n />\n </ng-container>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n </div>\n <hr class=\"govuk-section-break govuk-section-break--m\"/>\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 *ngIf=\"config.showCancelFilterButton\"\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",
1605
1777
  changeDetection: ChangeDetectionStrategy.OnPush,
1606
1778
  encapsulation: ViewEncapsulation.None,
1607
- styles: [".contain-classes .elevated-break{margin-bottom:20px}@media (min-width:40.0625em){.contain-classes .elevated-break{margin-bottom:30px}}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-direction:column;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0}.contain-classes .govuk-select{width:100%}"]
1779
+ styles: [".contain-classes .elevated-break{margin-bottom:20px}@media (min-width:40.0625em){.contain-classes .elevated-break{margin-bottom:30px}}.contain-classes .govuk-body--maxWidth480px{max-width:480px}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-direction:column;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0}.contain-classes .xui-generic-filter__field-title{display:flex;align-items:center;margin-bottom:10px}.contain-classes .govuk-select{width:100%}"]
1608
1780
  }] }
1609
1781
  ];
1610
1782
  /** @nocollapse */
@@ -3885,7 +4057,7 @@ var LocationService = /** @class */ (function () {
3885
4057
 
3886
4058
  /**
3887
4059
  * @fileoverview added by tsickle
3888
- * Generated from: lib/services/session-storage/session-storage.service.ts
4060
+ * Generated from: lib/services/storage/session-storage/session-storage.service.ts
3889
4061
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3890
4062
  */
3891
4063
  var SessionStorageService = /** @class */ (function () {
@@ -4463,7 +4635,7 @@ var FindLocationComponent = /** @class */ (function () {
4463
4635
  FindLocationComponent.decorators = [
4464
4636
  { type: Component, args: [{
4465
4637
  selector: 'xuilib-find-location',
4466
- template: "<div class=\"location-picker-custom\">\n <div class=\"search-location\">\n <div>\n <label id=\"input-selected-location-label\" *ngIf=\"locationTitle\">{{locationTitle}}</label>\n </div>\n\n <div class=\"search-location__input-container\">\n <exui-search-location class=\"search-location__input\"\n [locations]=\"locations\"\n [selectedLocations]=\"selectedLocations\"\n [singleMode]=\"field.maxSelected === 1\"\n [bookingCheck]=\"field.bookingCheckType\"\n [delay]=\"300\"\n [disabled]=\"disabled\"\n [serviceIds]=\"serviceIds\"\n (locationInputChanged)=\"onInputChanged($event)\"\n (locationSelected)=\"onLocationSelected($event)\"\n (searchLocationChanged)=\"onSearchInputChanged()\"\n [locationType]=\"'case-management'\"></exui-search-location>\n <a href=\"javascript:void(0)\" (click)=\"addLocation()\" class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\" data-module=\"govuk-button\" *ngIf=\"enableAddLocationButton\">\n Add\n </a>\n </div>\n </div>\n <ul class=\"hmcts-filter-tags selection-container\" *ngIf=\"field.maxSelected != 1\">\n <li class=\"location-selection\" *ngFor=\"let selection of selectedLocations\">\n <a class=\"hmcts-filter__tag\" (click)=\"removeLocation(selection)\" href=\"javascript:void(0)\">\n {{ selection.site_name }}\n </a>\n </li>\n </ul>\n</div>\n",
4638
+ template: "<div class=\"location-picker-custom\">\n <div class=\"search-location\">\n <div>\n <label id=\"input-selected-location-label\" *ngIf=\"locationTitle\">{{locationTitle}}</label>\n </div>\n\n <div class=\"search-location__input-container\">\n <exui-search-location class=\"search-location__input\"\n [locations]=\"locations\"\n [selectedLocations]=\"selectedLocations\"\n [singleMode]=\"field.maxSelected === 1\"\n [bookingCheck]=\"field.bookingCheckType\"\n [delay]=\"300\"\n [disabled]=\"disabled\"\n [serviceIds]=\"serviceIds\"\n (locationInputChanged)=\"onInputChanged($event)\"\n (locationSelected)=\"onLocationSelected($event)\"\n (searchLocationChanged)=\"onSearchInputChanged()\"\n [locationType]=\"'case-management'\"></exui-search-location>\n <a href=\"javascript:void(0)\" (click)=\"addLocation()\"\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\" data-module=\"govuk-button\"\n *ngIf=\"enableAddLocationButton\">\n Add\n </a>\n </div>\n </div>\n <ul class=\"hmcts-filter-tags selection-container\" *ngIf=\"field.maxSelected != 1\">\n <li class=\"location-selection\" *ngFor=\"let selection of selectedLocations\">\n <a class=\"hmcts-filter__tag\" (click)=\"removeLocation(selection)\" href=\"javascript:void(0)\">\n {{ selection.site_name }}\n </a>\n </li>\n </ul>\n</div>\n",
4467
4639
  styles: [".search-location__input-container{display:flex}.search-location .auto-complete-container{min-width:unset;width:calc(100% - 4px)}.search-location__input{flex:1 0 auto}.search-location .govuk-button--secondary{background-color:#ddd}"]
4468
4640
  }] }
4469
4641
  ];
@@ -5191,15 +5363,28 @@ var FindPersonComponent = /** @class */ (function () {
5191
5363
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5192
5364
  */
5193
5365
  var FindServiceComponent = /** @class */ (function () {
5194
- function FindServiceComponent(fb) {
5195
- this.fb = fb;
5196
- this.serviceTitle = 'Search for a service by name';
5366
+ function FindServiceComponent() {
5367
+ this.services = [];
5368
+ this.selectedServices = [];
5197
5369
  this.enableAddServiceButton = true;
5198
- this.disableInputField = false;
5199
- this.form = this.fb.group({
5200
- searchTerm: ['']
5201
- });
5370
+ this.disabled = false;
5371
+ this.serviceFieldChanged = new EventEmitter();
5372
+ this.tempSelectedService = null;
5202
5373
  }
5374
+ /**
5375
+ * @return {?}
5376
+ */
5377
+ FindServiceComponent.prototype.ngOnInit = /**
5378
+ * @return {?}
5379
+ */
5380
+ function () {
5381
+ this.selectedServices = this.selectedServices !== null ? this.selectedServices.filter((/**
5382
+ * @param {?} service
5383
+ * @return {?}
5384
+ */
5385
+ function (service) { return service.key; })) : [];
5386
+ this.SortAnOptions();
5387
+ };
5203
5388
  /**
5204
5389
  * @return {?}
5205
5390
  */
@@ -5207,19 +5392,149 @@ var FindServiceComponent = /** @class */ (function () {
5207
5392
  * @return {?}
5208
5393
  */
5209
5394
  function () {
5210
- // Todo
5395
+ var _this = this;
5396
+ if (this.tempSelectedService === null) {
5397
+ return;
5398
+ }
5399
+ this.selectedServices = __spread(this.selectedServices, [this.tempSelectedService]);
5400
+ this.addSelectedServicesToForm([this.tempSelectedService]);
5401
+ this.services = this.services.filter((/**
5402
+ * @param {?} s
5403
+ * @return {?}
5404
+ */
5405
+ function (s) { return s.key !== _this.tempSelectedService.key; }));
5406
+ this.tempSelectedService = null;
5407
+ this.serviceFieldChanged.emit();
5408
+ };
5409
+ /**
5410
+ * @param {?} service
5411
+ * @return {?}
5412
+ */
5413
+ FindServiceComponent.prototype.removeService = /**
5414
+ * @param {?} service
5415
+ * @return {?}
5416
+ */
5417
+ function (service) {
5418
+ if (service.key) {
5419
+ this.selectedServices = this.selectedServices !== null ? this.selectedServices.filter((/**
5420
+ * @param {?} selectedService
5421
+ * @return {?}
5422
+ */
5423
+ function (selectedService) { return selectedService.key !== service.key; })) : [];
5424
+ /** @type {?} */
5425
+ var formArray = (/** @type {?} */ (this.form.get(this.field.name)));
5426
+ /** @type {?} */
5427
+ var index = (formArray.value).findIndex((/**
5428
+ * @param {?} selectedService
5429
+ * @return {?}
5430
+ */
5431
+ function (selectedService) { return selectedService.key === service.key; }));
5432
+ if (index > -1) {
5433
+ formArray.removeAt(index);
5434
+ this.services.splice(index, 0, service);
5435
+ this.SortAnOptions();
5436
+ }
5437
+ this.serviceFieldChanged.emit();
5438
+ }
5439
+ };
5440
+ /**
5441
+ * @param {?} service
5442
+ * @return {?}
5443
+ */
5444
+ FindServiceComponent.prototype.onServiceSelected = /**
5445
+ * @param {?} service
5446
+ * @return {?}
5447
+ */
5448
+ function (service) {
5449
+ if (!service) {
5450
+ this.tempSelectedService = null;
5451
+ return;
5452
+ }
5453
+ if (this.field.maxSelected === 1) {
5454
+ this.removeSelectedValues();
5455
+ this.addSelectedServicesToForm([service]);
5456
+ }
5457
+ else {
5458
+ if (!this.selectedServices.find((/**
5459
+ * @param {?} s
5460
+ * @return {?}
5461
+ */
5462
+ function (s) { return s.key === service.key; }))) {
5463
+ if (service.key) {
5464
+ this.tempSelectedService = service;
5465
+ }
5466
+ }
5467
+ }
5468
+ };
5469
+ /**
5470
+ * @private
5471
+ * @return {?}
5472
+ */
5473
+ FindServiceComponent.prototype.removeSelectedValues = /**
5474
+ * @private
5475
+ * @return {?}
5476
+ */
5477
+ function () {
5478
+ /** @type {?} */
5479
+ var formArray = (/** @type {?} */ (this.form.get(this.field.name)));
5480
+ for (var i = 0; i < formArray.length; i++) {
5481
+ formArray.removeAt(i);
5482
+ }
5483
+ this.selectedServices = [];
5484
+ };
5485
+ /**
5486
+ * @private
5487
+ * @param {?} services
5488
+ * @return {?}
5489
+ */
5490
+ FindServiceComponent.prototype.addSelectedServicesToForm = /**
5491
+ * @private
5492
+ * @param {?} services
5493
+ * @return {?}
5494
+ */
5495
+ function (services) {
5496
+ var e_1, _a;
5497
+ /** @type {?} */
5498
+ var formArray = (/** @type {?} */ (this.form.get(this.field.name)));
5499
+ try {
5500
+ for (var services_1 = __values(services), services_1_1 = services_1.next(); !services_1_1.done; services_1_1 = services_1.next()) {
5501
+ var service = services_1_1.value;
5502
+ formArray.push(new FormControl(service));
5503
+ }
5504
+ }
5505
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5506
+ finally {
5507
+ try {
5508
+ if (services_1_1 && !services_1_1.done && (_a = services_1.return)) _a.call(services_1);
5509
+ }
5510
+ finally { if (e_1) throw e_1.error; }
5511
+ }
5512
+ };
5513
+ /**
5514
+ * @private
5515
+ * @return {?}
5516
+ */
5517
+ FindServiceComponent.prototype.SortAnOptions = /**
5518
+ * @private
5519
+ * @return {?}
5520
+ */
5521
+ function () {
5522
+ return this.services.sort((/**
5523
+ * @param {?} a
5524
+ * @param {?} b
5525
+ * @return {?}
5526
+ */
5527
+ function (a, b) {
5528
+ return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : (b.label.toLowerCase() > a.label.toLowerCase() ? -1 : 0);
5529
+ }));
5211
5530
  };
5212
5531
  FindServiceComponent.decorators = [
5213
5532
  { type: Component, args: [{
5214
5533
  selector: 'xuilib-find-service',
5215
- template: "<div class=\"service-picker-custom\">\n <div class=\"search-service\">\n <div class=\"govuk-body\">\n <label id=\"input-selected-service-label\" *ngIf=\"serviceTitle\">{{serviceTitle}}</label>\n </div>\n <div class=\"search-service__input-container\">\n <exui-search-service class=\"search-service__input\"\n [services]=\"services\"\n [selectedServices]=\"selectedServices\"\n [delay]=\"300\"\n [disabled]=\"disabled\"></exui-search-service>\n <a href=\"javascript:void(0)\" (click)=\"addService()\" class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\"\n data-module=\"govuk-button\" *ngIf=\"enableAddServiceButton\" id=\"add-service\">\n Add\n </a>\n </div>\n </div>\n <ul class=\"hmcts-filter-tags selection-container\" *ngIf=\"field.maxSelected != 1\">\n <li class=\"service-selection\" *ngFor=\"let selection of selectedServices\">\n <a class=\"hmcts-filter__tag\" href=\"javascript:void(0)\">\n {{ selection.name }}\n </a>\n </li>\n </ul>\n</div>\n",
5534
+ template: "<div class=\"service-picker-custom\">\n <div class=\"search-service\">\n <div class=\"govuk-body\">\n <label id=\"selectServiceSearch-label\" for=\"serviceSearch__select\" *ngIf=\"serviceTitle\">\n {{ serviceTitle}}\n </label>\n </div>\n <div class=\"search-service__input-container\">\n <exui-search-service class=\"search-service__input\" [services]=\"services\"\n (serviceChanged)=\"onServiceSelected($event)\">\n </exui-search-service>\n <a href=\"javascript:void(0)\" (click)=\"addService()\"\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\" data-module=\"govuk-button\"\n *ngIf=\"enableAddServiceButton\" id=\"add-service\">\n Add\n </a>\n </div>\n </div>\n <ul class=\"hmcts-filter-tags selection-container\" *ngIf=\"field.maxSelected != 1\">\n <li class=\"location-selection\" *ngFor=\"let selection of selectedServices\">\n <a class=\"hmcts-filter__tag\" (click)=\"removeService(selection)\" href=\"javascript:void(0)\">\n {{ selection.label }}\n </a>\n </li>\n </ul>\n</div>",
5216
5535
  styles: ["#add-service{background-color:#ddd}.search-service__input-container{display:flex}.search-service__input{flex:1 0 auto}"]
5217
5536
  }] }
5218
5537
  ];
5219
- /** @nocollapse */
5220
- FindServiceComponent.ctorParameters = function () { return [
5221
- { type: FormBuilder }
5222
- ]; };
5223
5538
  FindServiceComponent.propDecorators = {
5224
5539
  field: [{ type: Input }],
5225
5540
  fields: [{ type: Input }],
@@ -5227,9 +5542,9 @@ var FindServiceComponent = /** @class */ (function () {
5227
5542
  form: [{ type: Input }],
5228
5543
  services: [{ type: Input }],
5229
5544
  selectedServices: [{ type: Input }],
5230
- disabled: [{ type: Input }],
5231
5545
  enableAddServiceButton: [{ type: Input }],
5232
- disableInputField: [{ type: Input }]
5546
+ disabled: [{ type: Input }],
5547
+ serviceFieldChanged: [{ type: Output }]
5233
5548
  };
5234
5549
  return FindServiceComponent;
5235
5550
  }());
@@ -5482,42 +5797,36 @@ var SearchJudicialsComponent = /** @class */ (function () {
5482
5797
  */
5483
5798
  var SearchServiceComponent = /** @class */ (function () {
5484
5799
  function SearchServiceComponent() {
5485
- this.showAutocomplete = false;
5486
- this.minSearchCharacters = 3;
5487
- this.term = '';
5800
+ this.services = [];
5801
+ this.serviceChanged = new EventEmitter();
5488
5802
  }
5489
5803
  /**
5804
+ * @param {?} key
5490
5805
  * @return {?}
5491
5806
  */
5492
- SearchServiceComponent.prototype.onInput = /**
5493
- * @return {?}
5494
- */
5495
- function () {
5496
- // Todo
5497
- };
5498
- /**
5499
- * @return {?}
5500
- */
5501
- SearchServiceComponent.prototype.onSelectionChange = /**
5807
+ SearchServiceComponent.prototype.onSelectionChanged = /**
5808
+ * @param {?} key
5502
5809
  * @return {?}
5503
5810
  */
5504
- function () {
5505
- // Todo
5811
+ function (key) {
5812
+ /** @type {?} */
5813
+ var selectedService = this.services.find((/**
5814
+ * @param {?} s
5815
+ * @return {?}
5816
+ */
5817
+ function (s) { return s.key === key; }));
5818
+ this.serviceChanged.emit(selectedService);
5506
5819
  };
5507
5820
  SearchServiceComponent.decorators = [
5508
5821
  { type: Component, args: [{
5509
5822
  selector: 'exui-search-service',
5510
- template: "<div class=\"auto-complete-container\">\n <input\n id=\"inputServiceSearch\"\n (input)=\"onInput()\"\n [formControl]=\"form?.controls?.searchTerm\"\n [matAutocomplete]=\"autoSearchService\"\n class=\"govuk-input\"\n [attr.disabled]=\"disabled\">\n <mat-autocomplete class=\"mat-autocomplete-panel-extend\" autoActiveFirstOption #autoSearchService=\"matAutocomplete\">\n <mat-option *ngFor=\"let service of services\" (onSelectionChange)=\"onSelectionChange()\">\n {{ service.name }}\n </mat-option>\n <mat-option *ngIf=\"!services?.length && showAutocomplete && term && term.length >= this.minSearchCharacters\">No results found</mat-option>\n </mat-autocomplete>\n</div>\n",
5823
+ template: "<div class=\"govuk-form-group\">\n <select id=\"serviceSearch__select\" class=\"govuk-select\" name=\"serviceSearch__select\"\n (change)=\"onSelectionChanged($event.target.value)\">\n <option [value]=\"null\">All</option>\n <option *ngFor=\"let service of services\" [value]=\"service.key\">\n {{ service.label }}\n </option>\n </select>\n</div>",
5511
5824
  styles: [".autocomplete__input--show-all-values{padding:5px 34px 5px 5px;cursor:pointer}.autocomplete__dropdown-arrow-down{z-index:-1;display:inline-block;position:absolute;right:8px;width:24px;height:24px;top:10px}.autocomplete__menu{background-color:#fff;border:2px solid #0b0c0c;border-top:0;color:#0b0c0c;margin:0;max-height:342px;overflow-x:hidden;padding:0;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{box-shadow:rgba(0,0,0,.256863) 0 2px 6px;left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-bottom:solid #b1b4b6;border-width:1px 0;cursor:pointer;display:block;position:relative}.autocomplete__option>*{pointer-events:none}.autocomplete__option:first-of-type{border-top-width:0}.autocomplete__option:last-of-type{border-bottom-width:0}.autocomplete__option--odd{background-color:#fafafa}.autocomplete__option--focused,.autocomplete__option:hover{background-color:#1d70b8;border-color:#1d70b8;color:#fff;outline:0}.autocomplete__option--no-results{background-color:#fafafa;color:#646b6f;cursor:not-allowed}.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:13px;line-height:1.25}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:13px;line-height:1.31579}}.div-action{display:inline-block}.add-location{display:inline}.remove-location-button{margin:5px}.hide-autocomplete{display:none}.auto-complete-container{width:calc(100% - 4px);display:inline-block;margin-right:4px}.autocomplete__input{line-height:24px;font-size:19px}"]
5512
5825
  }] }
5513
5826
  ];
5514
5827
  SearchServiceComponent.propDecorators = {
5515
5828
  services: [{ type: Input }],
5516
- selectedServices: [{ type: Input }],
5517
- disabled: [{ type: Input }],
5518
- delay: [{ type: Input }],
5519
- form: [{ type: Input }],
5520
- showAutocomplete: [{ type: Input }]
5829
+ serviceChanged: [{ type: Output }]
5521
5830
  };
5522
5831
  return SearchServiceComponent;
5523
5832
  }());
@@ -6885,6 +7194,33 @@ var RemoveHostDirective = /** @class */ (function () {
6885
7194
  return RemoveHostDirective;
6886
7195
  }());
6887
7196
 
7197
+ /**
7198
+ * @fileoverview added by tsickle
7199
+ * Generated from: lib/pipes/capitalize.pipe.ts
7200
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7201
+ */
7202
+ var CapitalizePipe = /** @class */ (function () {
7203
+ function CapitalizePipe() {
7204
+ }
7205
+ /**
7206
+ * @param {?} value
7207
+ * @return {?}
7208
+ */
7209
+ CapitalizePipe.prototype.transform = /**
7210
+ * @param {?} value
7211
+ * @return {?}
7212
+ */
7213
+ function (value) {
7214
+ /** @type {?} */
7215
+ var lowerCaseString = value.toLowerCase();
7216
+ return lowerCaseString.charAt(0).toUpperCase() + lowerCaseString.slice(1);
7217
+ };
7218
+ CapitalizePipe.decorators = [
7219
+ { type: Pipe, args: [{ name: 'capitalize' },] }
7220
+ ];
7221
+ return CapitalizePipe;
7222
+ }());
7223
+
6888
7224
  /**
6889
7225
  * @fileoverview added by tsickle
6890
7226
  * Generated from: lib/exui-common-lib.module.ts
@@ -6954,13 +7290,17 @@ var GOV_UI_COMPONENTS = [
6954
7290
  GovUkFileUploadComponent,
6955
7291
  RemoveHostDirective
6956
7292
  ];
7293
+ /** @type {?} */
7294
+ var pipes = [
7295
+ CapitalizePipe
7296
+ ];
6957
7297
  var ɵ0 = windowProvider;
6958
7298
  var ExuiCommonLibModule = /** @class */ (function () {
6959
7299
  function ExuiCommonLibModule() {
6960
7300
  }
6961
7301
  ExuiCommonLibModule.decorators = [
6962
7302
  { type: NgModule, args: [{
6963
- declarations: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS),
7303
+ declarations: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS, pipes),
6964
7304
  imports: [
6965
7305
  CommonModule,
6966
7306
  FormsModule,
@@ -6976,7 +7316,7 @@ var ExuiCommonLibModule = /** @class */ (function () {
6976
7316
  ],
6977
7317
  exports: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS, [
6978
7318
  PaginatePipe
6979
- ])
7319
+ ], pipes)
6980
7320
  },] }
6981
7321
  ];
6982
7322
  return ExuiCommonLibModule;
@@ -8002,6 +8342,6 @@ var LoadingService = /** @class */ (function () {
8002
8342
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
8003
8343
  */
8004
8344
 
8005
- export { AccessibilityComponent, CheckboxListComponent, ContactDetailsComponent, DueDateComponent, GenericFilterComponent, HmctsSessionDialogComponent, InviteUserFormComponent, InviteUserPermissionComponent, LoadingSpinnerComponent, SelectedCaseConfirmComponent, SelectedCaseListComponent, SelectedCaseComponent, ServiceMessageComponent, ServiceMessagesComponent, ShareCaseConfirmComponent, ShareCaseComponent, TabComponent, TcConfirmComponent, TcDisplayHtmlComponent, TcDisplayPlainComponent, TermsAndConditionsComponent, UserDetailsComponent, UserListComponent, CookieBannerComponent, FindLocationComponent, SearchLocationComponent, PaginationComponent, FeatureToggleDirective, LetContext, LetDirective, COMMON_COMPONENTS, GOV_UI_COMPONENTS, ExuiCommonLibModule, GovUiService, checkboxesBeCheckedValidator, dateValidator, radioGroupValidator, HmctsSubNavigationComponent, BadgeColour, DateBadgeColour, SECONDS_IN_A_DAY, AnonymousFeatureUser, LoggedInFeatureUser, BookingCheckType, PersonRole, RoleCategory, RadioFilterFieldConfig, FeatureToggleGuard, FeatureToggleService, LaunchDarklyService, GoogleAnalyticsService, GoogleTagManagerService, ManageSessionServices, TimeoutNotificationsService, RoleMatching, RoleGuard, RoleService, CookieService, HasLoadingState, LoadingService, FilterService, windowProvider, windowToken, AccessibilityComponent as ɵx, CheckboxListComponent as ɵz, ContactDetailsComponent as ɵf, CookieBannerComponent as ɵbf, DueDateComponent as ɵy, ExuiPageWrapperComponent as ɵa, FindLocationComponent as ɵbl, FindPersonComponent as ɵbh, FindServiceComponent as ɵbo, GenericFilterComponent as ɵbd, HmctsSessionDialogComponent as ɵk, InviteUserFormComponent as ɵo, InviteUserPermissionComponent as ɵn, LoadingSpinnerComponent as ɵbc, PaginationComponent as ɵbr, SearchJudicialsComponent as ɵbk, SearchLocationComponent as ɵbm, SearchServiceComponent as ɵbp, SearchVenueComponent as ɵbq, SelectedCaseConfirmComponent as ɵv, SelectedCaseListComponent as ɵt, SelectedCaseComponent as ɵu, ServiceMessageComponent as ɵba, ServiceMessagesComponent as ɵbb, ShareCaseConfirmComponent as ɵs, ShareCaseComponent as ɵp, TabComponent as ɵw, TcConfirmComponent as ɵe, TcDisplayHtmlComponent as ɵc, TcDisplayPlainComponent as ɵd, TermsAndConditionsComponent as ɵb, UserDetailsComponent as ɵm, UserListComponent as ɵl, UserSelectComponent as ɵq, FeatureToggleDirective as ɵg, LetContext as ɵi, LetDirective as ɵj, GovUkCheckboxComponent as ɵcb, GovUkCheckboxesComponent as ɵch, GovUkDateComponent as ɵcg, GovUkErrorMessageComponent as ɵce, GovUkFieldsetComponent as ɵcf, GovUkFileUploadComponent as ɵcm, GovUkFormGroupWrapperComponent as ɵcc, GovUkInputComponent as ɵca, GovUkLabelComponent as ɵcd, GovUkRadioComponent as ɵci, GovUkRadiosComponent as ɵcj, GovUkSelectComponent as ɵck, GovukTableComponent as ɵbz, GovUkTextareaComponent as ɵcl, HmctsBannerComponent as ɵby, HmctsErrorSummaryComponent as ɵbw, HmctsIdentityBarComponent as ɵbs, HmctsMainWrapperComponent as ɵbx, HmctsPaginationComponent as ɵbt, HmctsPrimaryNavigationComponent as ɵbv, HmctsSubNavigationComponent as ɵbu, RemoveHostDirective as ɵcn, CaseSharingStateService as ɵr, CookieService as ɵbg, FeatureToggleService as ɵh, FilterService as ɵbe, FindAPersonService as ɵbi, LocationService as ɵbn, SessionStorageService as ɵbj };
8345
+ export { AccessibilityComponent, CheckboxListComponent, ContactDetailsComponent, DueDateComponent, GenericFilterComponent, HmctsSessionDialogComponent, InviteUserFormComponent, InviteUserPermissionComponent, LoadingSpinnerComponent, SelectedCaseConfirmComponent, SelectedCaseListComponent, SelectedCaseComponent, ServiceMessageComponent, ServiceMessagesComponent, ShareCaseConfirmComponent, ShareCaseComponent, TabComponent, TcConfirmComponent, TcDisplayHtmlComponent, TcDisplayPlainComponent, TermsAndConditionsComponent, UserDetailsComponent, UserListComponent, CookieBannerComponent, FindLocationComponent, SearchLocationComponent, PaginationComponent, FeatureToggleDirective, LetContext, LetDirective, COMMON_COMPONENTS, GOV_UI_COMPONENTS, ExuiCommonLibModule, GovUiService, checkboxesBeCheckedValidator, dateValidator, radioGroupValidator, HmctsSubNavigationComponent, BadgeColour, DateBadgeColour, SECONDS_IN_A_DAY, AnonymousFeatureUser, LoggedInFeatureUser, BookingCheckType, PersonRole, RoleCategory, RadioFilterFieldConfig, FeatureToggleGuard, FeatureToggleService, LaunchDarklyService, GoogleAnalyticsService, GoogleTagManagerService, ManageSessionServices, TimeoutNotificationsService, RoleMatching, RoleGuard, RoleService, CookieService, HasLoadingState, LoadingService, FilterService, windowProvider, windowToken, AccessibilityComponent as ɵx, CheckboxListComponent as ɵz, ContactDetailsComponent as ɵf, CookieBannerComponent as ɵbf, DueDateComponent as ɵy, ExuiPageWrapperComponent as ɵa, FindLocationComponent as ɵbl, FindPersonComponent as ɵbh, FindServiceComponent as ɵbo, GenericFilterComponent as ɵbd, HmctsSessionDialogComponent as ɵk, InviteUserFormComponent as ɵo, InviteUserPermissionComponent as ɵn, LoadingSpinnerComponent as ɵbc, PaginationComponent as ɵbr, SearchJudicialsComponent as ɵbk, SearchLocationComponent as ɵbm, SearchServiceComponent as ɵbp, SearchVenueComponent as ɵbq, SelectedCaseConfirmComponent as ɵv, SelectedCaseListComponent as ɵt, SelectedCaseComponent as ɵu, ServiceMessageComponent as ɵba, ServiceMessagesComponent as ɵbb, ShareCaseConfirmComponent as ɵs, ShareCaseComponent as ɵp, TabComponent as ɵw, TcConfirmComponent as ɵe, TcDisplayHtmlComponent as ɵc, TcDisplayPlainComponent as ɵd, TermsAndConditionsComponent as ɵb, UserDetailsComponent as ɵm, UserListComponent as ɵl, UserSelectComponent as ɵq, FeatureToggleDirective as ɵg, LetContext as ɵi, LetDirective as ɵj, GovUkCheckboxComponent as ɵcb, GovUkCheckboxesComponent as ɵch, GovUkDateComponent as ɵcg, GovUkErrorMessageComponent as ɵce, GovUkFieldsetComponent as ɵcf, GovUkFileUploadComponent as ɵcm, GovUkFormGroupWrapperComponent as ɵcc, GovUkInputComponent as ɵca, GovUkLabelComponent as ɵcd, GovUkRadioComponent as ɵci, GovUkRadiosComponent as ɵcj, GovUkSelectComponent as ɵck, GovukTableComponent as ɵbz, GovUkTextareaComponent as ɵcl, HmctsBannerComponent as ɵby, HmctsErrorSummaryComponent as ɵbw, HmctsIdentityBarComponent as ɵbs, HmctsMainWrapperComponent as ɵbx, HmctsPaginationComponent as ɵbt, HmctsPrimaryNavigationComponent as ɵbv, HmctsSubNavigationComponent as ɵbu, RemoveHostDirective as ɵcn, CapitalizePipe as ɵco, CaseSharingStateService as ɵr, CookieService as ɵbg, FeatureToggleService as ɵh, FilterService as ɵbe, FindAPersonService as ɵbi, LocationService as ɵbn, SessionStorageService as ɵbj };
8006
8346
 
8007
8347
  //# sourceMappingURL=hmcts-rpx-xui-common-lib.js.map