@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
@@ -709,10 +709,10 @@
709
709
  return this.filterSettings[id];
710
710
  }
711
711
  if (sessionStorage.getItem(id)) {
712
- return JSON.parse(window.sessionStorage.getItem(id));
712
+ return JSON.parse(sessionStorage.getItem(id));
713
713
  }
714
714
  if (localStorage.getItem(id)) {
715
- return JSON.parse(window.localStorage.getItem(id));
715
+ return JSON.parse(localStorage.getItem(id));
716
716
  }
717
717
  return null;
718
718
  };
@@ -730,6 +730,24 @@
730
730
  }
731
731
  return this.streams[id].asObservable();
732
732
  };
733
+ /**
734
+ * @param {?} id
735
+ * @return {?}
736
+ */
737
+ FilterService.prototype.clearSessionAndLocalPersistance = /**
738
+ * @param {?} id
739
+ * @return {?}
740
+ */
741
+ function (id) {
742
+ sessionStorage.removeItem(id);
743
+ localStorage.removeItem(id);
744
+ if (this.filterSettings[id] !== undefined) {
745
+ this.filterSettings[id] = null;
746
+ }
747
+ if (this.streams[id] !== undefined) {
748
+ this.streams[id].next(null);
749
+ }
750
+ };
733
751
  /**
734
752
  * @private
735
753
  * @param {?} setting
@@ -741,7 +759,7 @@
741
759
  * @return {?}
742
760
  */
743
761
  function (setting) {
744
- window.localStorage.setItem(setting.id, JSON.stringify(setting));
762
+ localStorage.setItem(setting.id, JSON.stringify(setting));
745
763
  };
746
764
  /**
747
765
  * @private
@@ -754,7 +772,7 @@
754
772
  * @return {?}
755
773
  */
756
774
  function (setting) {
757
- window.sessionStorage.setItem(setting.id, JSON.stringify(setting));
775
+ sessionStorage.setItem(setting.id, JSON.stringify(setting));
758
776
  };
759
777
  /**
760
778
  * @private
@@ -917,10 +935,10 @@
917
935
  function (field) {
918
936
  /** @type {?} */
919
937
  var validators = [];
920
- if (field && field.minSelected) {
938
+ if (field && field.minSelected > 0) {
921
939
  validators.push(minSelectedValidator(field.minSelected));
922
940
  }
923
- if (field && field.maxSelected) {
941
+ if (field && field.maxSelected > 0) {
924
942
  validators.push(maxSelectedValidator(field.maxSelected));
925
943
  }
926
944
  return validators;
@@ -941,6 +959,7 @@
941
959
  this.formSub = this.form.valueChanges.subscribe(( /**
942
960
  * @return {?}
943
961
  */function () { return _this.submitted = false; }));
962
+ this.filterSkillsByServices(null, this.config);
944
963
  };
945
964
  /**
946
965
  * @return {?}
@@ -1067,6 +1086,9 @@
1067
1086
  else {
1068
1087
  this.emitFormErrors(form);
1069
1088
  }
1089
+ if (this._config.applyButtonCallback) {
1090
+ this._config.applyButtonCallback();
1091
+ }
1070
1092
  };
1071
1093
  // when domain changes ensure that person field is reset
1072
1094
  // when domain changes ensure that person field is reset
@@ -1120,6 +1142,11 @@
1120
1142
  * @return {?}
1121
1143
  */
1122
1144
  function (field) {
1145
+ if (field.name === 'user-services') {
1146
+ /** @type {?} */
1147
+ var selectedServices = this.getSelectedValuesForFields(this.form.controls, field);
1148
+ this.filterSkillsByServices(selectedServices, this.config);
1149
+ }
1123
1150
  if (field.radioSelectionChange && typeof field.radioSelectionChange === 'string') {
1124
1151
  var _a = __read(field.enableCondition.split('='), 2), name_3 = _a[0], value = _a[1];
1125
1152
  this.form.get(name_3).patchValue(value);
@@ -1141,6 +1168,9 @@
1141
1168
  this.filterService.persist(settings, this.config.persistence);
1142
1169
  this.filterService.givenErrors.next(null);
1143
1170
  this.submitted = false;
1171
+ if (this.config.cancelButtonCallback) {
1172
+ this.config.cancelButtonCallback();
1173
+ }
1144
1174
  };
1145
1175
  /**
1146
1176
  * @param {?} values
@@ -1404,9 +1434,9 @@
1404
1434
  var formArray = this_1.buildCheckBoxFormArray(field, settings);
1405
1435
  this_1.form.addControl(field.name, formArray);
1406
1436
  }
1407
- else if (field.type === 'find-location') {
1437
+ else if (field.type === 'find-location' || field.type === 'find-service') {
1408
1438
  /** @type {?} */
1409
- var formArray = this_1.buildFindLocationFormArray(field, settings);
1439
+ var formArray = this_1.buildFormArray(field, settings);
1410
1440
  this_1.form.addControl(field.name, formArray);
1411
1441
  }
1412
1442
  else {
@@ -1417,6 +1447,9 @@
1417
1447
  if (field.type === 'text-input') {
1418
1448
  validators.push(forms.Validators.minLength(field.minSelected));
1419
1449
  }
1450
+ if (field.type === 'email-input') {
1451
+ validators.push(forms.Validators.email);
1452
+ }
1420
1453
  }
1421
1454
  /** @type {?} */
1422
1455
  var defaultValue = null;
@@ -1448,7 +1481,7 @@
1448
1481
  });
1449
1482
  this_1.form.addControl(field.name, formGroup);
1450
1483
  }
1451
- else {
1484
+ else if (field.type !== 'group-title') {
1452
1485
  /** @type {?} */
1453
1486
  var control = new forms.FormControl(defaultValue, validators);
1454
1487
  this_1.form.addControl(field.name, control);
@@ -1544,7 +1577,7 @@
1544
1577
  * @param {?} settings
1545
1578
  * @return {?}
1546
1579
  */
1547
- GenericFilterComponent.prototype.buildFindLocationFormArray = /**
1580
+ GenericFilterComponent.prototype.buildFormArray = /**
1548
1581
  * @private
1549
1582
  * @param {?} field
1550
1583
  * @param {?} settings
@@ -1643,11 +1676,11 @@
1643
1676
  var field = _c.value;
1644
1677
  /** @type {?} */
1645
1678
  var formGroup = form.get(field.name);
1646
- if (formGroup && formGroup.errors && formGroup.errors.minlength) {
1679
+ if (formGroup && formGroup.errors && (formGroup.errors.minlength || formGroup.errors.required)) {
1647
1680
  errors.push({ name: field.name, error: field.minSelectedError });
1648
1681
  }
1649
- if (formGroup && formGroup.errors && formGroup.errors.maxLength) {
1650
- errors.push({ name: field.name, error: field.minSelectedError });
1682
+ if (formGroup && formGroup.errors && formGroup.errors.maxlength) {
1683
+ errors.push({ name: field.name, error: field.maxSelectedError });
1651
1684
  }
1652
1685
  }
1653
1686
  }
@@ -1664,17 +1697,148 @@
1664
1697
  throw e_8.error;
1665
1698
  }
1666
1699
  }
1700
+ // remove duplicates
1701
+ errors = errors.filter(( /**
1702
+ * @param {?} filterError
1703
+ * @param {?} i
1704
+ * @param {?} arr
1705
+ * @return {?}
1706
+ */function (filterError, i, arr) {
1707
+ return errors.indexOf(arr.find(( /**
1708
+ * @param {?} item
1709
+ * @return {?}
1710
+ */function (item) { return item.name === filterError.name; }))) === i;
1711
+ }));
1667
1712
  if (errors.length) {
1668
1713
  this.filterService.givenErrors.next(errors);
1669
1714
  }
1670
1715
  };
1716
+ /**
1717
+ * @param {?} services
1718
+ * @param {?} config
1719
+ * @return {?}
1720
+ */
1721
+ GenericFilterComponent.prototype.filterSkillsByServices = /**
1722
+ * @param {?} services
1723
+ * @param {?} config
1724
+ * @return {?}
1725
+ */
1726
+ function (services, config) {
1727
+ var _this = this;
1728
+ this.filteredSkillsByServices = [];
1729
+ /** @type {?} */
1730
+ var userSkillsField = config.fields.find(( /**
1731
+ * @param {?} f
1732
+ * @return {?}
1733
+ */function (f) { return f.name === 'user-skills'; }));
1734
+ if (userSkillsField) {
1735
+ /** @type {?} */
1736
+ var userSkills_1 = userSkillsField.groupOptions;
1737
+ if (!services || services.length === 0) {
1738
+ this.filteredSkillsByServices = userSkills_1;
1739
+ }
1740
+ else {
1741
+ services.forEach(( /**
1742
+ * @param {?} s
1743
+ * @return {?}
1744
+ */function (s) {
1745
+ /** @type {?} */
1746
+ var groupOption = userSkills_1.find(( /**
1747
+ * @param {?} u
1748
+ * @return {?}
1749
+ */function (u) { return u.group === s; }));
1750
+ if (groupOption) {
1751
+ _this.filteredSkillsByServices.push(groupOption);
1752
+ }
1753
+ }));
1754
+ }
1755
+ }
1756
+ this.filteredSkillsByServices = this.sortGroupOptions(this.filteredSkillsByServices);
1757
+ return this.filteredSkillsByServices;
1758
+ };
1759
+ /**
1760
+ * @private
1761
+ * @param {?} formValues
1762
+ * @param {?} field
1763
+ * @return {?}
1764
+ */
1765
+ GenericFilterComponent.prototype.getSelectedValuesForFields = /**
1766
+ * @private
1767
+ * @param {?} formValues
1768
+ * @param {?} field
1769
+ * @return {?}
1770
+ */
1771
+ function (formValues, field) {
1772
+ /** @type {?} */
1773
+ var selectedValues = [];
1774
+ Object.keys(formValues).map(( /**
1775
+ * @param {?} name
1776
+ * @return {?}
1777
+ */function (name) {
1778
+ /** @type {?} */
1779
+ var values = formValues[name].value;
1780
+ if (name === field.name) {
1781
+ values.forEach(( /**
1782
+ * @param {?} v
1783
+ * @return {?}
1784
+ */function (v) {
1785
+ selectedValues.push(v.key);
1786
+ }));
1787
+ }
1788
+ }));
1789
+ return selectedValues;
1790
+ };
1791
+ /**
1792
+ * @private
1793
+ * @param {?} groupOptions
1794
+ * @return {?}
1795
+ */
1796
+ GenericFilterComponent.prototype.sortGroupOptions = /**
1797
+ * @private
1798
+ * @param {?} groupOptions
1799
+ * @return {?}
1800
+ */
1801
+ function (groupOptions) {
1802
+ /** @type {?} */
1803
+ var sortedResults = [];
1804
+ /** @type {?} */
1805
+ var groups = groupOptions.map(( /**
1806
+ * @param {?} go
1807
+ * @return {?}
1808
+ */function (go) { return go.group; }));
1809
+ groups.sort().forEach(( /**
1810
+ * @param {?} g
1811
+ * @return {?}
1812
+ */function (g) {
1813
+ /** @type {?} */
1814
+ var options = groupOptions.find(( /**
1815
+ * @param {?} go
1816
+ * @return {?}
1817
+ */function (go) { return go.group === g; })).options;
1818
+ /** @type {?} */
1819
+ var sortedOptions = options.sort(( /**
1820
+ * @param {?} a
1821
+ * @param {?} b
1822
+ * @return {?}
1823
+ */function (a, b) {
1824
+ return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : (b.label.toLowerCase() > a.label.toLowerCase() ? -1 : 0);
1825
+ }));
1826
+ /** @type {?} */
1827
+ var result = {
1828
+ group: g,
1829
+ options: sortedOptions
1830
+ };
1831
+ sortedResults.push(result);
1832
+ }));
1833
+ return sortedResults;
1834
+ };
1671
1835
  GenericFilterComponent.decorators = [
1672
1836
  { type: i0.Component, args: [{
1673
1837
  selector: 'xuilib-generic-filter',
1674
- 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",
1838
+ 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",
1675
1839
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1676
1840
  encapsulation: i0.ViewEncapsulation.None,
1677
- 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%}"]
1841
+ 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%}"]
1678
1842
  }] }
1679
1843
  ];
1680
1844
  /** @nocollapse */
@@ -3940,7 +4104,7 @@
3940
4104
 
3941
4105
  /**
3942
4106
  * @fileoverview added by tsickle
3943
- * Generated from: lib/services/session-storage/session-storage.service.ts
4107
+ * Generated from: lib/services/storage/session-storage/session-storage.service.ts
3944
4108
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3945
4109
  */
3946
4110
  var SessionStorageService = /** @class */ (function () {
@@ -4506,7 +4670,7 @@
4506
4670
  FindLocationComponent.decorators = [
4507
4671
  { type: i0.Component, args: [{
4508
4672
  selector: 'xuilib-find-location',
4509
- 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",
4673
+ 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",
4510
4674
  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}"]
4511
4675
  }] }
4512
4676
  ];
@@ -5216,15 +5380,27 @@
5216
5380
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5217
5381
  */
5218
5382
  var FindServiceComponent = /** @class */ (function () {
5219
- function FindServiceComponent(fb) {
5220
- this.fb = fb;
5221
- this.serviceTitle = 'Search for a service by name';
5383
+ function FindServiceComponent() {
5384
+ this.services = [];
5385
+ this.selectedServices = [];
5222
5386
  this.enableAddServiceButton = true;
5223
- this.disableInputField = false;
5224
- this.form = this.fb.group({
5225
- searchTerm: ['']
5226
- });
5387
+ this.disabled = false;
5388
+ this.serviceFieldChanged = new i0.EventEmitter();
5389
+ this.tempSelectedService = null;
5227
5390
  }
5391
+ /**
5392
+ * @return {?}
5393
+ */
5394
+ FindServiceComponent.prototype.ngOnInit = /**
5395
+ * @return {?}
5396
+ */
5397
+ function () {
5398
+ this.selectedServices = this.selectedServices !== null ? this.selectedServices.filter(( /**
5399
+ * @param {?} service
5400
+ * @return {?}
5401
+ */function (service) { return service.key; })) : [];
5402
+ this.SortAnOptions();
5403
+ };
5228
5404
  /**
5229
5405
  * @return {?}
5230
5406
  */
@@ -5232,21 +5408,150 @@
5232
5408
  * @return {?}
5233
5409
  */
5234
5410
  function () {
5235
- // Todo
5411
+ var _this = this;
5412
+ if (this.tempSelectedService === null) {
5413
+ return;
5414
+ }
5415
+ this.selectedServices = __spread(this.selectedServices, [this.tempSelectedService]);
5416
+ this.addSelectedServicesToForm([this.tempSelectedService]);
5417
+ this.services = this.services.filter(( /**
5418
+ * @param {?} s
5419
+ * @return {?}
5420
+ */function (s) { return s.key !== _this.tempSelectedService.key; }));
5421
+ this.tempSelectedService = null;
5422
+ this.serviceFieldChanged.emit();
5423
+ };
5424
+ /**
5425
+ * @param {?} service
5426
+ * @return {?}
5427
+ */
5428
+ FindServiceComponent.prototype.removeService = /**
5429
+ * @param {?} service
5430
+ * @return {?}
5431
+ */
5432
+ function (service) {
5433
+ if (service.key) {
5434
+ this.selectedServices = this.selectedServices !== null ? this.selectedServices.filter(( /**
5435
+ * @param {?} selectedService
5436
+ * @return {?}
5437
+ */function (selectedService) { return selectedService.key !== service.key; })) : [];
5438
+ /** @type {?} */
5439
+ var formArray = ( /** @type {?} */(this.form.get(this.field.name)));
5440
+ /** @type {?} */
5441
+ var index = (formArray.value).findIndex(( /**
5442
+ * @param {?} selectedService
5443
+ * @return {?}
5444
+ */function (selectedService) { return selectedService.key === service.key; }));
5445
+ if (index > -1) {
5446
+ formArray.removeAt(index);
5447
+ this.services.splice(index, 0, service);
5448
+ this.SortAnOptions();
5449
+ }
5450
+ this.serviceFieldChanged.emit();
5451
+ }
5452
+ };
5453
+ /**
5454
+ * @param {?} service
5455
+ * @return {?}
5456
+ */
5457
+ FindServiceComponent.prototype.onServiceSelected = /**
5458
+ * @param {?} service
5459
+ * @return {?}
5460
+ */
5461
+ function (service) {
5462
+ if (!service) {
5463
+ this.tempSelectedService = null;
5464
+ return;
5465
+ }
5466
+ if (this.field.maxSelected === 1) {
5467
+ this.removeSelectedValues();
5468
+ this.addSelectedServicesToForm([service]);
5469
+ }
5470
+ else {
5471
+ if (!this.selectedServices.find(( /**
5472
+ * @param {?} s
5473
+ * @return {?}
5474
+ */function (s) { return s.key === service.key; }))) {
5475
+ if (service.key) {
5476
+ this.tempSelectedService = service;
5477
+ }
5478
+ }
5479
+ }
5480
+ };
5481
+ /**
5482
+ * @private
5483
+ * @return {?}
5484
+ */
5485
+ FindServiceComponent.prototype.removeSelectedValues = /**
5486
+ * @private
5487
+ * @return {?}
5488
+ */
5489
+ function () {
5490
+ /** @type {?} */
5491
+ var formArray = ( /** @type {?} */(this.form.get(this.field.name)));
5492
+ for (var i = 0; i < formArray.length; i++) {
5493
+ formArray.removeAt(i);
5494
+ }
5495
+ this.selectedServices = [];
5496
+ };
5497
+ /**
5498
+ * @private
5499
+ * @param {?} services
5500
+ * @return {?}
5501
+ */
5502
+ FindServiceComponent.prototype.addSelectedServicesToForm = /**
5503
+ * @private
5504
+ * @param {?} services
5505
+ * @return {?}
5506
+ */
5507
+ function (services) {
5508
+ var e_1, _a;
5509
+ /** @type {?} */
5510
+ var formArray = ( /** @type {?} */(this.form.get(this.field.name)));
5511
+ try {
5512
+ for (var services_1 = __values(services), services_1_1 = services_1.next(); !services_1_1.done; services_1_1 = services_1.next()) {
5513
+ var service = services_1_1.value;
5514
+ formArray.push(new forms.FormControl(service));
5515
+ }
5516
+ }
5517
+ catch (e_1_1) {
5518
+ e_1 = { error: e_1_1 };
5519
+ }
5520
+ finally {
5521
+ try {
5522
+ if (services_1_1 && !services_1_1.done && (_a = services_1.return))
5523
+ _a.call(services_1);
5524
+ }
5525
+ finally {
5526
+ if (e_1)
5527
+ throw e_1.error;
5528
+ }
5529
+ }
5530
+ };
5531
+ /**
5532
+ * @private
5533
+ * @return {?}
5534
+ */
5535
+ FindServiceComponent.prototype.SortAnOptions = /**
5536
+ * @private
5537
+ * @return {?}
5538
+ */
5539
+ function () {
5540
+ return this.services.sort(( /**
5541
+ * @param {?} a
5542
+ * @param {?} b
5543
+ * @return {?}
5544
+ */function (a, b) {
5545
+ return a.label.toLowerCase() > b.label.toLowerCase() ? 1 : (b.label.toLowerCase() > a.label.toLowerCase() ? -1 : 0);
5546
+ }));
5236
5547
  };
5237
5548
  FindServiceComponent.decorators = [
5238
5549
  { type: i0.Component, args: [{
5239
5550
  selector: 'xuilib-find-service',
5240
- 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",
5551
+ 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>",
5241
5552
  styles: ["#add-service{background-color:#ddd}.search-service__input-container{display:flex}.search-service__input{flex:1 0 auto}"]
5242
5553
  }] }
5243
5554
  ];
5244
- /** @nocollapse */
5245
- FindServiceComponent.ctorParameters = function () {
5246
- return [
5247
- { type: forms.FormBuilder }
5248
- ];
5249
- };
5250
5555
  FindServiceComponent.propDecorators = {
5251
5556
  field: [{ type: i0.Input }],
5252
5557
  fields: [{ type: i0.Input }],
@@ -5254,9 +5559,9 @@
5254
5559
  form: [{ type: i0.Input }],
5255
5560
  services: [{ type: i0.Input }],
5256
5561
  selectedServices: [{ type: i0.Input }],
5257
- disabled: [{ type: i0.Input }],
5258
5562
  enableAddServiceButton: [{ type: i0.Input }],
5259
- disableInputField: [{ type: i0.Input }]
5563
+ disabled: [{ type: i0.Input }],
5564
+ serviceFieldChanged: [{ type: i0.Output }]
5260
5565
  };
5261
5566
  return FindServiceComponent;
5262
5567
  }());
@@ -5507,42 +5812,35 @@
5507
5812
  */
5508
5813
  var SearchServiceComponent = /** @class */ (function () {
5509
5814
  function SearchServiceComponent() {
5510
- this.showAutocomplete = false;
5511
- this.minSearchCharacters = 3;
5512
- this.term = '';
5815
+ this.services = [];
5816
+ this.serviceChanged = new i0.EventEmitter();
5513
5817
  }
5514
5818
  /**
5819
+ * @param {?} key
5515
5820
  * @return {?}
5516
5821
  */
5517
- SearchServiceComponent.prototype.onInput = /**
5518
- * @return {?}
5519
- */
5520
- function () {
5521
- // Todo
5522
- };
5523
- /**
5524
- * @return {?}
5525
- */
5526
- SearchServiceComponent.prototype.onSelectionChange = /**
5822
+ SearchServiceComponent.prototype.onSelectionChanged = /**
5823
+ * @param {?} key
5527
5824
  * @return {?}
5528
5825
  */
5529
- function () {
5530
- // Todo
5826
+ function (key) {
5827
+ /** @type {?} */
5828
+ var selectedService = this.services.find(( /**
5829
+ * @param {?} s
5830
+ * @return {?}
5831
+ */function (s) { return s.key === key; }));
5832
+ this.serviceChanged.emit(selectedService);
5531
5833
  };
5532
5834
  SearchServiceComponent.decorators = [
5533
5835
  { type: i0.Component, args: [{
5534
5836
  selector: 'exui-search-service',
5535
- 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",
5837
+ 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>",
5536
5838
  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}"]
5537
5839
  }] }
5538
5840
  ];
5539
5841
  SearchServiceComponent.propDecorators = {
5540
5842
  services: [{ type: i0.Input }],
5541
- selectedServices: [{ type: i0.Input }],
5542
- disabled: [{ type: i0.Input }],
5543
- delay: [{ type: i0.Input }],
5544
- form: [{ type: i0.Input }],
5545
- showAutocomplete: [{ type: i0.Input }]
5843
+ serviceChanged: [{ type: i0.Output }]
5546
5844
  };
5547
5845
  return SearchServiceComponent;
5548
5846
  }());
@@ -6905,6 +7203,33 @@
6905
7203
  return RemoveHostDirective;
6906
7204
  }());
6907
7205
 
7206
+ /**
7207
+ * @fileoverview added by tsickle
7208
+ * Generated from: lib/pipes/capitalize.pipe.ts
7209
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7210
+ */
7211
+ var CapitalizePipe = /** @class */ (function () {
7212
+ function CapitalizePipe() {
7213
+ }
7214
+ /**
7215
+ * @param {?} value
7216
+ * @return {?}
7217
+ */
7218
+ CapitalizePipe.prototype.transform = /**
7219
+ * @param {?} value
7220
+ * @return {?}
7221
+ */
7222
+ function (value) {
7223
+ /** @type {?} */
7224
+ var lowerCaseString = value.toLowerCase();
7225
+ return lowerCaseString.charAt(0).toUpperCase() + lowerCaseString.slice(1);
7226
+ };
7227
+ CapitalizePipe.decorators = [
7228
+ { type: i0.Pipe, args: [{ name: 'capitalize' },] }
7229
+ ];
7230
+ return CapitalizePipe;
7231
+ }());
7232
+
6908
7233
  /**
6909
7234
  * @fileoverview added by tsickle
6910
7235
  * Generated from: lib/exui-common-lib.module.ts
@@ -6974,13 +7299,17 @@
6974
7299
  GovUkFileUploadComponent,
6975
7300
  RemoveHostDirective
6976
7301
  ];
7302
+ /** @type {?} */
7303
+ var pipes = [
7304
+ CapitalizePipe
7305
+ ];
6977
7306
  var ɵ0 = windowProvider;
6978
7307
  var ExuiCommonLibModule = /** @class */ (function () {
6979
7308
  function ExuiCommonLibModule() {
6980
7309
  }
6981
7310
  ExuiCommonLibModule.decorators = [
6982
7311
  { type: i0.NgModule, args: [{
6983
- declarations: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS),
7312
+ declarations: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS, pipes),
6984
7313
  imports: [
6985
7314
  i4.CommonModule,
6986
7315
  forms.FormsModule,
@@ -6996,7 +7325,7 @@
6996
7325
  ],
6997
7326
  exports: __spread(COMMON_COMPONENTS, GOV_UI_COMPONENTS, [
6998
7327
  ngxPagination.PaginatePipe
6999
- ])
7328
+ ], pipes)
7000
7329
  },] }
7001
7330
  ];
7002
7331
  return ExuiCommonLibModule;
@@ -8126,6 +8455,7 @@
8126
8455
  exports.ɵbv = HmctsPrimaryNavigationComponent;
8127
8456
  exports.ɵbu = HmctsSubNavigationComponent;
8128
8457
  exports.ɵcn = RemoveHostDirective;
8458
+ exports.ɵco = CapitalizePipe;
8129
8459
  exports.ɵr = CaseSharingStateService;
8130
8460
  exports.ɵbg = CookieService;
8131
8461
  exports.ɵh = FeatureToggleService;