@hmcts/rpx-xui-common-lib 1.7.45 → 1.7.47-callback-apply-filter-v1

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 +387 -57
  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 +155 -13
  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 +59 -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 +171 -12
  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 +59 -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 +336 -56
  32. package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
  33. package/fesm5/hmcts-rpx-xui-common-lib.js +400 -57
  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 +26 -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, Pipe, Directive, TemplateRef, ViewContainerRef, ElementRef, 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 {?}
@@ -1031,6 +1050,9 @@ var GenericFilterComponent = /** @class */ (function () {
1031
1050
  else {
1032
1051
  this.emitFormErrors(form);
1033
1052
  }
1053
+ if (this._config.applyButtonCallback) {
1054
+ this._config.applyButtonCallback();
1055
+ }
1034
1056
  };
1035
1057
  // when domain changes ensure that person field is reset
1036
1058
  // when domain changes ensure that person field is reset
@@ -1078,6 +1100,11 @@ var GenericFilterComponent = /** @class */ (function () {
1078
1100
  * @return {?}
1079
1101
  */
1080
1102
  function (field) {
1103
+ if (field.name === 'user-services') {
1104
+ /** @type {?} */
1105
+ var selectedServices = this.getSelectedValuesForFields(this.form.controls, field);
1106
+ this.filterSkillsByServices(selectedServices, this.config);
1107
+ }
1081
1108
  if (field.radioSelectionChange && typeof field.radioSelectionChange === 'string') {
1082
1109
  var _a = __read(field.enableCondition.split('='), 2), name_3 = _a[0], value = _a[1];
1083
1110
  this.form.get(name_3).patchValue(value);
@@ -1099,6 +1126,9 @@ var GenericFilterComponent = /** @class */ (function () {
1099
1126
  this.filterService.persist(settings, this.config.persistence);
1100
1127
  this.filterService.givenErrors.next(null);
1101
1128
  this.submitted = false;
1129
+ if (this.config.cancelButtonCallback) {
1130
+ this.config.cancelButtonCallback();
1131
+ }
1102
1132
  };
1103
1133
  /**
1104
1134
  * @param {?} values
@@ -1351,9 +1381,9 @@ var GenericFilterComponent = /** @class */ (function () {
1351
1381
  var formArray = this_1.buildCheckBoxFormArray(field, settings);
1352
1382
  this_1.form.addControl(field.name, formArray);
1353
1383
  }
1354
- else if (field.type === 'find-location') {
1384
+ else if (field.type === 'find-location' || field.type === 'find-service') {
1355
1385
  /** @type {?} */
1356
- var formArray = this_1.buildFindLocationFormArray(field, settings);
1386
+ var formArray = this_1.buildFormArray(field, settings);
1357
1387
  this_1.form.addControl(field.name, formArray);
1358
1388
  }
1359
1389
  else {
@@ -1364,6 +1394,9 @@ var GenericFilterComponent = /** @class */ (function () {
1364
1394
  if (field.type === 'text-input') {
1365
1395
  validators.push(Validators.minLength(field.minSelected));
1366
1396
  }
1397
+ if (field.type === 'email-input') {
1398
+ validators.push(Validators.email);
1399
+ }
1367
1400
  }
1368
1401
  /** @type {?} */
1369
1402
  var defaultValue = null;
@@ -1397,7 +1430,7 @@ var GenericFilterComponent = /** @class */ (function () {
1397
1430
  });
1398
1431
  this_1.form.addControl(field.name, formGroup);
1399
1432
  }
1400
- else {
1433
+ else if (field.type !== 'group-title') {
1401
1434
  /** @type {?} */
1402
1435
  var control = new FormControl(defaultValue, validators);
1403
1436
  this_1.form.addControl(field.name, control);
@@ -1483,7 +1516,7 @@ var GenericFilterComponent = /** @class */ (function () {
1483
1516
  * @param {?} settings
1484
1517
  * @return {?}
1485
1518
  */
1486
- GenericFilterComponent.prototype.buildFindLocationFormArray = /**
1519
+ GenericFilterComponent.prototype.buildFormArray = /**
1487
1520
  * @private
1488
1521
  * @param {?} field
1489
1522
  * @param {?} settings
@@ -1579,11 +1612,11 @@ var GenericFilterComponent = /** @class */ (function () {
1579
1612
  var field = _c.value;
1580
1613
  /** @type {?} */
1581
1614
  var formGroup = form.get(field.name);
1582
- if (formGroup && formGroup.errors && formGroup.errors.minlength) {
1615
+ if (formGroup && formGroup.errors && (formGroup.errors.minlength || formGroup.errors.required)) {
1583
1616
  errors.push({ name: field.name, error: field.minSelectedError });
1584
1617
  }
1585
- if (formGroup && formGroup.errors && formGroup.errors.maxLength) {
1586
- errors.push({ name: field.name, error: field.minSelectedError });
1618
+ if (formGroup && formGroup.errors && formGroup.errors.maxlength) {
1619
+ errors.push({ name: field.name, error: field.maxSelectedError });
1587
1620
  }
1588
1621
  }
1589
1622
  }
@@ -1594,17 +1627,159 @@ var GenericFilterComponent = /** @class */ (function () {
1594
1627
  }
1595
1628
  finally { if (e_8) throw e_8.error; }
1596
1629
  }
1630
+ // remove duplicates
1631
+ errors = errors.filter((/**
1632
+ * @param {?} filterError
1633
+ * @param {?} i
1634
+ * @param {?} arr
1635
+ * @return {?}
1636
+ */
1637
+ function (filterError, i, arr) {
1638
+ return errors.indexOf(arr.find((/**
1639
+ * @param {?} item
1640
+ * @return {?}
1641
+ */
1642
+ function (item) { return item.name === filterError.name; }))) === i;
1643
+ }));
1597
1644
  if (errors.length) {
1598
1645
  this.filterService.givenErrors.next(errors);
1599
1646
  }
1600
1647
  };
1648
+ /**
1649
+ * @param {?} services
1650
+ * @param {?} config
1651
+ * @return {?}
1652
+ */
1653
+ GenericFilterComponent.prototype.filterSkillsByServices = /**
1654
+ * @param {?} services
1655
+ * @param {?} config
1656
+ * @return {?}
1657
+ */
1658
+ function (services, config) {
1659
+ var _this = this;
1660
+ this.filteredSkillsByServices = [];
1661
+ /** @type {?} */
1662
+ var userSkillsField = config.fields.find((/**
1663
+ * @param {?} f
1664
+ * @return {?}
1665
+ */
1666
+ function (f) { return f.name === 'user-skills'; }));
1667
+ if (userSkillsField) {
1668
+ /** @type {?} */
1669
+ var userSkills_1 = userSkillsField.groupOptions;
1670
+ if (!services || services.length === 0) {
1671
+ this.filteredSkillsByServices = userSkills_1;
1672
+ }
1673
+ else {
1674
+ services.forEach((/**
1675
+ * @param {?} s
1676
+ * @return {?}
1677
+ */
1678
+ function (s) {
1679
+ /** @type {?} */
1680
+ var groupOption = userSkills_1.find((/**
1681
+ * @param {?} u
1682
+ * @return {?}
1683
+ */
1684
+ function (u) { return u.group === s; }));
1685
+ if (groupOption) {
1686
+ _this.filteredSkillsByServices.push(groupOption);
1687
+ }
1688
+ }));
1689
+ }
1690
+ }
1691
+ this.filteredSkillsByServices = this.sortGroupOptions(this.filteredSkillsByServices);
1692
+ return this.filteredSkillsByServices;
1693
+ };
1694
+ /**
1695
+ * @private
1696
+ * @param {?} formValues
1697
+ * @param {?} field
1698
+ * @return {?}
1699
+ */
1700
+ GenericFilterComponent.prototype.getSelectedValuesForFields = /**
1701
+ * @private
1702
+ * @param {?} formValues
1703
+ * @param {?} field
1704
+ * @return {?}
1705
+ */
1706
+ function (formValues, field) {
1707
+ /** @type {?} */
1708
+ var selectedValues = [];
1709
+ Object.keys(formValues).map((/**
1710
+ * @param {?} name
1711
+ * @return {?}
1712
+ */
1713
+ function (name) {
1714
+ /** @type {?} */
1715
+ var values = formValues[name].value;
1716
+ if (name === field.name) {
1717
+ values.forEach((/**
1718
+ * @param {?} v
1719
+ * @return {?}
1720
+ */
1721
+ function (v) {
1722
+ selectedValues.push(v.key);
1723
+ }));
1724
+ }
1725
+ }));
1726
+ return selectedValues;
1727
+ };
1728
+ /**
1729
+ * @private
1730
+ * @param {?} groupOptions
1731
+ * @return {?}
1732
+ */
1733
+ GenericFilterComponent.prototype.sortGroupOptions = /**
1734
+ * @private
1735
+ * @param {?} groupOptions
1736
+ * @return {?}
1737
+ */
1738
+ function (groupOptions) {
1739
+ /** @type {?} */
1740
+ var sortedResults = [];
1741
+ /** @type {?} */
1742
+ var groups = groupOptions.map((/**
1743
+ * @param {?} go
1744
+ * @return {?}
1745
+ */
1746
+ function (go) { return go.group; }));
1747
+ groups.sort().forEach((/**
1748
+ * @param {?} g
1749
+ * @return {?}
1750
+ */
1751
+ function (g) {
1752
+ /** @type {?} */
1753
+ var options = groupOptions.find((/**
1754
+ * @param {?} go
1755
+ * @return {?}
1756
+ */
1757
+ function (go) { return go.group === g; })).options;
1758
+ /** @type {?} */
1759
+ var sortedOptions = options.sort((/**
1760
+ * @param {?} a
1761
+ * @param {?} b
1762
+ * @return {?}
1763
+ */
1764
+ function (a, b) {
1765
+ return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : (b.label.toLowerCase() > a.label.toLowerCase() ? -1 : 0);
1766
+ }));
1767
+ /** @type {?} */
1768
+ var result = {
1769
+ group: g,
1770
+ options: sortedOptions
1771
+ };
1772
+ sortedResults.push(result);
1773
+ }));
1774
+ return sortedResults;
1775
+ };
1601
1776
  GenericFilterComponent.decorators = [
1602
1777
  { type: Component, args: [{
1603
1778
  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",
1779
+ 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 [attr.maxlength]=\"field.maxlength ? field.maxlength : null\"\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
1780
  changeDetection: ChangeDetectionStrategy.OnPush,
1606
1781
  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%}"]
1782
+ 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
1783
  }] }
1609
1784
  ];
1610
1785
  /** @nocollapse */
@@ -3885,7 +4060,7 @@ var LocationService = /** @class */ (function () {
3885
4060
 
3886
4061
  /**
3887
4062
  * @fileoverview added by tsickle
3888
- * Generated from: lib/services/session-storage/session-storage.service.ts
4063
+ * Generated from: lib/services/storage/session-storage/session-storage.service.ts
3889
4064
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3890
4065
  */
3891
4066
  var SessionStorageService = /** @class */ (function () {
@@ -4463,7 +4638,7 @@ var FindLocationComponent = /** @class */ (function () {
4463
4638
  FindLocationComponent.decorators = [
4464
4639
  { type: Component, args: [{
4465
4640
  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",
4641
+ 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
4642
  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
4643
  }] }
4469
4644
  ];
@@ -5191,15 +5366,28 @@ var FindPersonComponent = /** @class */ (function () {
5191
5366
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5192
5367
  */
5193
5368
  var FindServiceComponent = /** @class */ (function () {
5194
- function FindServiceComponent(fb) {
5195
- this.fb = fb;
5196
- this.serviceTitle = 'Search for a service by name';
5369
+ function FindServiceComponent() {
5370
+ this.services = [];
5371
+ this.selectedServices = [];
5197
5372
  this.enableAddServiceButton = true;
5198
- this.disableInputField = false;
5199
- this.form = this.fb.group({
5200
- searchTerm: ['']
5201
- });
5373
+ this.disabled = false;
5374
+ this.serviceFieldChanged = new EventEmitter();
5375
+ this.tempSelectedService = null;
5202
5376
  }
5377
+ /**
5378
+ * @return {?}
5379
+ */
5380
+ FindServiceComponent.prototype.ngOnInit = /**
5381
+ * @return {?}
5382
+ */
5383
+ function () {
5384
+ this.selectedServices = this.selectedServices !== null ? this.selectedServices.filter((/**
5385
+ * @param {?} service
5386
+ * @return {?}
5387
+ */
5388
+ function (service) { return service.key; })) : [];
5389
+ this.SortAnOptions();
5390
+ };
5203
5391
  /**
5204
5392
  * @return {?}
5205
5393
  */
@@ -5207,19 +5395,149 @@ var FindServiceComponent = /** @class */ (function () {
5207
5395
  * @return {?}
5208
5396
  */
5209
5397
  function () {
5210
- // Todo
5398
+ var _this = this;
5399
+ if (this.tempSelectedService === null) {
5400
+ return;
5401
+ }
5402
+ this.selectedServices = __spread(this.selectedServices, [this.tempSelectedService]);
5403
+ this.addSelectedServicesToForm([this.tempSelectedService]);
5404
+ this.services = this.services.filter((/**
5405
+ * @param {?} s
5406
+ * @return {?}
5407
+ */
5408
+ function (s) { return s.key !== _this.tempSelectedService.key; }));
5409
+ this.tempSelectedService = null;
5410
+ this.serviceFieldChanged.emit();
5411
+ };
5412
+ /**
5413
+ * @param {?} service
5414
+ * @return {?}
5415
+ */
5416
+ FindServiceComponent.prototype.removeService = /**
5417
+ * @param {?} service
5418
+ * @return {?}
5419
+ */
5420
+ function (service) {
5421
+ if (service.key) {
5422
+ this.selectedServices = this.selectedServices !== null ? this.selectedServices.filter((/**
5423
+ * @param {?} selectedService
5424
+ * @return {?}
5425
+ */
5426
+ function (selectedService) { return selectedService.key !== service.key; })) : [];
5427
+ /** @type {?} */
5428
+ var formArray = (/** @type {?} */ (this.form.get(this.field.name)));
5429
+ /** @type {?} */
5430
+ var index = (formArray.value).findIndex((/**
5431
+ * @param {?} selectedService
5432
+ * @return {?}
5433
+ */
5434
+ function (selectedService) { return selectedService.key === service.key; }));
5435
+ if (index > -1) {
5436
+ formArray.removeAt(index);
5437
+ this.services.splice(index, 0, service);
5438
+ this.SortAnOptions();
5439
+ }
5440
+ this.serviceFieldChanged.emit();
5441
+ }
5442
+ };
5443
+ /**
5444
+ * @param {?} service
5445
+ * @return {?}
5446
+ */
5447
+ FindServiceComponent.prototype.onServiceSelected = /**
5448
+ * @param {?} service
5449
+ * @return {?}
5450
+ */
5451
+ function (service) {
5452
+ if (!service) {
5453
+ this.tempSelectedService = null;
5454
+ return;
5455
+ }
5456
+ if (this.field.maxSelected === 1) {
5457
+ this.removeSelectedValues();
5458
+ this.addSelectedServicesToForm([service]);
5459
+ }
5460
+ else {
5461
+ if (!this.selectedServices.find((/**
5462
+ * @param {?} s
5463
+ * @return {?}
5464
+ */
5465
+ function (s) { return s.key === service.key; }))) {
5466
+ if (service.key) {
5467
+ this.tempSelectedService = service;
5468
+ }
5469
+ }
5470
+ }
5471
+ };
5472
+ /**
5473
+ * @private
5474
+ * @return {?}
5475
+ */
5476
+ FindServiceComponent.prototype.removeSelectedValues = /**
5477
+ * @private
5478
+ * @return {?}
5479
+ */
5480
+ function () {
5481
+ /** @type {?} */
5482
+ var formArray = (/** @type {?} */ (this.form.get(this.field.name)));
5483
+ for (var i = 0; i < formArray.length; i++) {
5484
+ formArray.removeAt(i);
5485
+ }
5486
+ this.selectedServices = [];
5487
+ };
5488
+ /**
5489
+ * @private
5490
+ * @param {?} services
5491
+ * @return {?}
5492
+ */
5493
+ FindServiceComponent.prototype.addSelectedServicesToForm = /**
5494
+ * @private
5495
+ * @param {?} services
5496
+ * @return {?}
5497
+ */
5498
+ function (services) {
5499
+ var e_1, _a;
5500
+ /** @type {?} */
5501
+ var formArray = (/** @type {?} */ (this.form.get(this.field.name)));
5502
+ try {
5503
+ for (var services_1 = __values(services), services_1_1 = services_1.next(); !services_1_1.done; services_1_1 = services_1.next()) {
5504
+ var service = services_1_1.value;
5505
+ formArray.push(new FormControl(service));
5506
+ }
5507
+ }
5508
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5509
+ finally {
5510
+ try {
5511
+ if (services_1_1 && !services_1_1.done && (_a = services_1.return)) _a.call(services_1);
5512
+ }
5513
+ finally { if (e_1) throw e_1.error; }
5514
+ }
5515
+ };
5516
+ /**
5517
+ * @private
5518
+ * @return {?}
5519
+ */
5520
+ FindServiceComponent.prototype.SortAnOptions = /**
5521
+ * @private
5522
+ * @return {?}
5523
+ */
5524
+ function () {
5525
+ return this.services.sort((/**
5526
+ * @param {?} a
5527
+ * @param {?} b
5528
+ * @return {?}
5529
+ */
5530
+ function (a, b) {
5531
+ return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : (b.label.toLowerCase() > a.label.toLowerCase() ? -1 : 0);
5532
+ }));
5211
5533
  };
5212
5534
  FindServiceComponent.decorators = [
5213
5535
  { type: Component, args: [{
5214
5536
  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",
5537
+ 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
5538
  styles: ["#add-service{background-color:#ddd}.search-service__input-container{display:flex}.search-service__input{flex:1 0 auto}"]
5217
5539
  }] }
5218
5540
  ];
5219
- /** @nocollapse */
5220
- FindServiceComponent.ctorParameters = function () { return [
5221
- { type: FormBuilder }
5222
- ]; };
5223
5541
  FindServiceComponent.propDecorators = {
5224
5542
  field: [{ type: Input }],
5225
5543
  fields: [{ type: Input }],
@@ -5227,9 +5545,9 @@ var FindServiceComponent = /** @class */ (function () {
5227
5545
  form: [{ type: Input }],
5228
5546
  services: [{ type: Input }],
5229
5547
  selectedServices: [{ type: Input }],
5230
- disabled: [{ type: Input }],
5231
5548
  enableAddServiceButton: [{ type: Input }],
5232
- disableInputField: [{ type: Input }]
5549
+ disabled: [{ type: Input }],
5550
+ serviceFieldChanged: [{ type: Output }]
5233
5551
  };
5234
5552
  return FindServiceComponent;
5235
5553
  }());
@@ -5482,42 +5800,36 @@ var SearchJudicialsComponent = /** @class */ (function () {
5482
5800
  */
5483
5801
  var SearchServiceComponent = /** @class */ (function () {
5484
5802
  function SearchServiceComponent() {
5485
- this.showAutocomplete = false;
5486
- this.minSearchCharacters = 3;
5487
- this.term = '';
5803
+ this.services = [];
5804
+ this.serviceChanged = new EventEmitter();
5488
5805
  }
5489
5806
  /**
5807
+ * @param {?} key
5490
5808
  * @return {?}
5491
5809
  */
5492
- SearchServiceComponent.prototype.onInput = /**
5493
- * @return {?}
5494
- */
5495
- function () {
5496
- // Todo
5497
- };
5498
- /**
5499
- * @return {?}
5500
- */
5501
- SearchServiceComponent.prototype.onSelectionChange = /**
5810
+ SearchServiceComponent.prototype.onSelectionChanged = /**
5811
+ * @param {?} key
5502
5812
  * @return {?}
5503
5813
  */
5504
- function () {
5505
- // Todo
5814
+ function (key) {
5815
+ /** @type {?} */
5816
+ var selectedService = this.services.find((/**
5817
+ * @param {?} s
5818
+ * @return {?}
5819
+ */
5820
+ function (s) { return s.key === key; }));
5821
+ this.serviceChanged.emit(selectedService);
5506
5822
  };
5507
5823
  SearchServiceComponent.decorators = [
5508
5824
  { type: Component, args: [{
5509
5825
  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",
5826
+ 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
5827
  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
5828
  }] }
5513
5829
  ];
5514
5830
  SearchServiceComponent.propDecorators = {
5515
5831
  services: [{ type: Input }],
5516
- selectedServices: [{ type: Input }],
5517
- disabled: [{ type: Input }],
5518
- delay: [{ type: Input }],
5519
- form: [{ type: Input }],
5520
- showAutocomplete: [{ type: Input }]
5832
+ serviceChanged: [{ type: Output }]
5521
5833
  };
5522
5834
  return SearchServiceComponent;
5523
5835
  }());
@@ -6885,6 +7197,33 @@ var RemoveHostDirective = /** @class */ (function () {
6885
7197
  return RemoveHostDirective;
6886
7198
  }());
6887
7199
 
7200
+ /**
7201
+ * @fileoverview added by tsickle
7202
+ * Generated from: lib/pipes/capitalize.pipe.ts
7203
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7204
+ */
7205
+ var CapitalizePipe = /** @class */ (function () {
7206
+ function CapitalizePipe() {
7207
+ }
7208
+ /**
7209
+ * @param {?} value
7210
+ * @return {?}
7211
+ */
7212
+ CapitalizePipe.prototype.transform = /**
7213
+ * @param {?} value
7214
+ * @return {?}
7215
+ */
7216
+ function (value) {
7217
+ /** @type {?} */
7218
+ var lowerCaseString = value.toLowerCase();
7219
+ return lowerCaseString.charAt(0).toUpperCase() + lowerCaseString.slice(1);
7220
+ };
7221
+ CapitalizePipe.decorators = [
7222
+ { type: Pipe, args: [{ name: 'capitalize' },] }
7223
+ ];
7224
+ return CapitalizePipe;
7225
+ }());
7226
+
6888
7227
  /**
6889
7228
  * @fileoverview added by tsickle
6890
7229
  * Generated from: lib/exui-common-lib.module.ts
@@ -6954,13 +7293,17 @@ var GOV_UI_COMPONENTS = [
6954
7293
  GovUkFileUploadComponent,
6955
7294
  RemoveHostDirective
6956
7295
  ];
7296
+ /** @type {?} */
7297
+ var pipes = [
7298
+ CapitalizePipe
7299
+ ];
6957
7300
  var ɵ0 = windowProvider;
6958
7301
  var ExuiCommonLibModule = /** @class */ (function () {
6959
7302
  function ExuiCommonLibModule() {
6960
7303
  }
6961
7304
  ExuiCommonLibModule.decorators = [
6962
7305
  { type: NgModule, args: [{
6963
- declarations: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS),
7306
+ declarations: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS, pipes),
6964
7307
  imports: [
6965
7308
  CommonModule,
6966
7309
  FormsModule,
@@ -6976,7 +7319,7 @@ var ExuiCommonLibModule = /** @class */ (function () {
6976
7319
  ],
6977
7320
  exports: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS, [
6978
7321
  PaginatePipe
6979
- ])
7322
+ ], pipes)
6980
7323
  },] }
6981
7324
  ];
6982
7325
  return ExuiCommonLibModule;
@@ -8002,6 +8345,6 @@ var LoadingService = /** @class */ (function () {
8002
8345
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
8003
8346
  */
8004
8347
 
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 };
8348
+ 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
8349
 
8007
8350
  //# sourceMappingURL=hmcts-rpx-xui-common-lib.js.map