@hmcts/rpx-xui-common-lib 1.8.10-generic-filter-readonly-changes → 1.8.10-generic-filter-readonly-changes-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/hmcts-rpx-xui-common-lib.umd.js +166 -93
- package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/components/find-location/find-location.component.js +3 -2
- package/esm2015/lib/components/find-service/find-service.component.js +7 -3
- package/esm2015/lib/components/generic-filter/generic-filter.component.js +79 -28
- package/esm2015/lib/components/search-service/search-service.component.js +12 -5
- package/esm2015/lib/models/filter.model.js +1 -1
- package/fesm2015/hmcts-rpx-xui-common-lib.js +130 -68
- package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
- package/lib/components/find-location/find-location.component.d.ts +1 -0
- package/lib/components/find-service/find-service.component.d.ts +3 -0
- package/lib/components/generic-filter/generic-filter.component.d.ts +3 -1
- package/lib/components/search-service/search-service.component.d.ts +2 -1
- package/lib/models/filter.model.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export class RadioFilterFieldConfig {
|
|
2
2
|
}
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsdGVyLm1vZGVsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvZXh1aS1jb21tb24tbGliL3NyYy9saWIvbW9kZWxzL2ZpbHRlci5tb2RlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEyRkEsTUFBTSxPQUFPLHNCQUFz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cnQgaW50ZXJmYWNlIEZpbHRlclNldHRpbmcge1xuICBpZDogc3RyaW5nO1xuICBpZGFtSWQ/OiBzdHJpbmc7XG4gIHJlc2V0PzogYm9vbGVhbjtcbiAgZmllbGRzOiB7IG5hbWU6IHN0cmluZywgdmFsdWU6IGFueVtdIH1bXTtcbn1cblxuZXhwb3J0IGNsYXNzIFJhZGlvRmlsdGVyRmllbGRDb25maWcgaW1wbGVtZW50cyBGaWx0ZXJGaWVsZENvbmZpZyB7XG4gIHB1YmxpYyBuYW1lOiBzdHJpbmc7XG4gIHB1YmxpYyBvcHRpb25zOiB7IGtleTogc3RyaW5nLCBsYWJlbDogc3RyaW5nfVtdO1xuICBwdWJsaWMgbWluU2VsZWN0ZWQ6IDE7XG4gIHB1YmxpYyBtYXhTZWxlY3RlZDogMTtcbiAgcHVibGljIHR5cGU6ICdyYWRpbyc7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgRmlsdGVyRXJyb3Ige1xuICBuYW1lOiBzdHJpbmc7XG4gIGVycm9yOiBzdHJpbmc7XG59XG4iXX0=
|
|
@@ -476,6 +476,12 @@ class GenericFilterComponent {
|
|
|
476
476
|
this.form.get('user-services').push(new FormControl({ key: 'All', label: 'All' }));
|
|
477
477
|
}
|
|
478
478
|
};
|
|
479
|
+
this.searchTermServiceForm = this.fb.group({
|
|
480
|
+
searchTerm: ['']
|
|
481
|
+
});
|
|
482
|
+
this.searchTermLocationForm = this.fb.group({
|
|
483
|
+
searchTerm: ['']
|
|
484
|
+
});
|
|
479
485
|
}
|
|
480
486
|
get config() {
|
|
481
487
|
return this._config;
|
|
@@ -520,7 +526,9 @@ class GenericFilterComponent {
|
|
|
520
526
|
const services = this.config.fields.find(field => field.name === 'user-services');
|
|
521
527
|
if (services) {
|
|
522
528
|
this.startFilterSkillsByServices(this.form, services);
|
|
523
|
-
this.
|
|
529
|
+
if (!this._config.copyFields) {
|
|
530
|
+
this.initValuesFromCacheForSkillsByServices();
|
|
531
|
+
}
|
|
524
532
|
}
|
|
525
533
|
}
|
|
526
534
|
ngOnDestroy() {
|
|
@@ -612,6 +620,15 @@ class GenericFilterComponent {
|
|
|
612
620
|
else {
|
|
613
621
|
this.emitFormErrors(form);
|
|
614
622
|
}
|
|
623
|
+
for (const field of this.config.fields) {
|
|
624
|
+
const fieldName = field.name;
|
|
625
|
+
if (fieldName === 'user-services') {
|
|
626
|
+
this.searchTermServiceForm.reset();
|
|
627
|
+
}
|
|
628
|
+
else if (fieldName === 'user-location') {
|
|
629
|
+
this.searchTermLocationForm.reset();
|
|
630
|
+
}
|
|
631
|
+
}
|
|
615
632
|
if (this._config.applyButtonCallback) {
|
|
616
633
|
this._config.applyButtonCallback();
|
|
617
634
|
}
|
|
@@ -632,8 +649,8 @@ class GenericFilterComponent {
|
|
|
632
649
|
this.form.get(name).patchValue(value);
|
|
633
650
|
}
|
|
634
651
|
}
|
|
635
|
-
inputServiceChanged(
|
|
636
|
-
if (
|
|
652
|
+
inputServiceChanged(selectedNotAddedService, field) {
|
|
653
|
+
if (selectedNotAddedService === undefined) {
|
|
637
654
|
this.addAllOption(field);
|
|
638
655
|
}
|
|
639
656
|
else {
|
|
@@ -891,12 +908,19 @@ class GenericFilterComponent {
|
|
|
891
908
|
emitFormErrors(form) {
|
|
892
909
|
let errors = [];
|
|
893
910
|
for (const field of this.config.fields) {
|
|
894
|
-
const
|
|
911
|
+
const fieldName = field.name;
|
|
912
|
+
const formGroup = form.get(fieldName);
|
|
895
913
|
if (formGroup && formGroup.errors && (formGroup.errors.minlength || formGroup.errors.required)) {
|
|
896
|
-
errors.push({ name:
|
|
914
|
+
errors.push({ name: fieldName, error: field.minSelectedError });
|
|
915
|
+
if (fieldName === 'user-services') {
|
|
916
|
+
this.searchTermServiceForm.reset();
|
|
917
|
+
}
|
|
918
|
+
else if (fieldName === 'user-location') {
|
|
919
|
+
this.searchTermLocationForm.reset();
|
|
920
|
+
}
|
|
897
921
|
}
|
|
898
922
|
if (formGroup && formGroup.errors && formGroup.errors.maxlength) {
|
|
899
|
-
errors.push({ name:
|
|
923
|
+
errors.push({ name: fieldName, error: field.maxSelectedError });
|
|
900
924
|
}
|
|
901
925
|
}
|
|
902
926
|
// remove duplicates
|
|
@@ -965,29 +989,56 @@ class GenericFilterComponent {
|
|
|
965
989
|
userSkillsCheckboxField.options = [];
|
|
966
990
|
userSkillsCheckboxField.options = this.filteredSkillsByServicesCheckbox;
|
|
967
991
|
this.form.setControl('user-skills', new FormArray([]));
|
|
968
|
-
this.
|
|
969
|
-
this.
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
if (this.
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
992
|
+
if (!this._config.copyFields) {
|
|
993
|
+
this.filteredSkillsByServicesCheckbox.forEach(() => {
|
|
994
|
+
this.form.get('user-skills').push(new FormControl(false));
|
|
995
|
+
});
|
|
996
|
+
const prevValues = this.filteredSkillsByServicesCheckbox.map(skill => {
|
|
997
|
+
let selected = false;
|
|
998
|
+
if (this.settings && this.settings.fields) {
|
|
999
|
+
if (this.previousSelectedNestedCheckbox.length > 0) {
|
|
1000
|
+
selected = this.previousSelectedNestedCheckbox.includes(skill.key);
|
|
1001
|
+
}
|
|
1002
|
+
let isSelectedUserSkill;
|
|
1003
|
+
const selectedUserSkills = this.settings.fields.find(setting => setting.name === 'user-skills');
|
|
1004
|
+
if (selectedUserSkills && selectedUserSkills.value && selectedUserSkills.value.length > 0) {
|
|
1005
|
+
isSelectedUserSkill = selectedUserSkills.value.findIndex(val => Number(val) === Number(skill.key));
|
|
1006
|
+
selected = isSelectedUserSkill !== -1;
|
|
1007
|
+
}
|
|
1008
|
+
if (this.previousSelectedNestedCheckbox.length > 0) {
|
|
1009
|
+
// Pick up from previous selected
|
|
1010
|
+
selected = this.previousSelectedNestedCheckbox.includes(String(skill.key));
|
|
1011
|
+
}
|
|
982
1012
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1013
|
+
return selected;
|
|
1014
|
+
});
|
|
1015
|
+
this.form.get('user-skills').setValue(prevValues);
|
|
1016
|
+
}
|
|
1017
|
+
else {
|
|
1018
|
+
const preSelectedSkills = [];
|
|
1019
|
+
this.filteredSkillsByServicesCheckbox.map((skillsByServices, index) => {
|
|
1020
|
+
for (let i = 0; i < this._config.preSelectedNestedCheckbox.length; i++) {
|
|
1021
|
+
const skillCopyValue = this._config.preSelectedNestedCheckbox[i];
|
|
1022
|
+
if (skillCopyValue.toString() === skillsByServices.key.toString()) {
|
|
1023
|
+
preSelectedSkills[index] = true;
|
|
1024
|
+
break;
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
preSelectedSkills[index] = false;
|
|
1028
|
+
}
|
|
986
1029
|
}
|
|
1030
|
+
});
|
|
1031
|
+
if (preSelectedSkills.length > 0) {
|
|
1032
|
+
preSelectedSkills.forEach((h) => {
|
|
1033
|
+
this.form.get('user-skills').push(new FormControl(h));
|
|
1034
|
+
});
|
|
987
1035
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1036
|
+
else {
|
|
1037
|
+
this.filteredSkillsByServicesCheckbox.map(() => {
|
|
1038
|
+
this.form.get('user-skills').push(new FormControl(false));
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
991
1042
|
return this.filteredSkillsByServicesCheckbox;
|
|
992
1043
|
}
|
|
993
1044
|
}
|
|
@@ -1026,7 +1077,7 @@ class GenericFilterComponent {
|
|
|
1026
1077
|
GenericFilterComponent.decorators = [
|
|
1027
1078
|
{ type: Component, args: [{
|
|
1028
1079
|
selector: 'xuilib-generic-filter',
|
|
1029
|
-
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 <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 <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?.maxLength)}\">\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 <div *ngIf=\"field?.titleHint\" class=\"govuk-!-margin-left-2\">\n {{ field.titleHint }}\n </div>\n </div>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMinSelectedError && submitted && form.get(field.name).errors?.minLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n <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 <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 *ngIf=\"field.defaultOption\" [attr.selected]=\"true\" [value]=\"field.defaultOption.key\">{{field.defaultOption.label}}</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 disabled selected hidden value=\"\">{{field.disabledText}}</option>\n <option *ngIf=\"field.defaultOption\" selected [value]=\"field.defaultOption.key\">{{field.defaultOption.label}}</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_' + field.name + item.key\"\n [name]=\"'checkbox_' + field.name + item.key\"\n />\n <label\n [for]=\"'checkbox_' + field.name + 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=\"'nested-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 filteredSkillsByServicesCheckbox; 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_' + field.name + item.key\"\n [name]=\"'checkbox_' + field.name + item.key\"\n />\n <label\n [for]=\"'checkbox_' + field.name + 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_' + field.name + item.key\"\n [name]=\"'checkbox_' + field.name + item.key\"\n />\n <label\n [for]=\"'checkbox_' + field.name + 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 [placeholderContent]=\"field.placeholderContent ? field.placeholderContent : ''\"\n [services]=\"form.get(field.servicesField)?.value\"\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 [field]=\"field\"\n [services]=\"form.get(field.findLocationField)?.value\"\n ></xuilib-find-location>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-task-name'\">\n <xuilib-find-task-name subTitle=\"\" (taskNameSelected)=\"updateTaskNameControls($event, field)\"\n (taskNameFieldChanged)=\"inputChanged(field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"form.get(field.domainField)?.value\"\n [findTaskNameGroup]=\"form\"\n [selectedTaskName]=\"form.get(field.name).value.taskName\"\n [userIncluded]=\"false\"\n ></xuilib-find-task-name>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-service'\">\n <xuilib-find-service (serviceFieldChanged)=\"inputServiceChanged($event, field)\"\n [form]=\"form\"\n [fields]=\"config.fields\"\n [title]=\"field.title\"\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 [readonly]=\"field.readonly\"\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 [readonly]=\"field.readonly\"\n />\n </ng-container>\n </div>\n </div>\n </ng-container>\n</ng-container>\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",
|
|
1080
|
+
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 <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 <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?.maxLength)}\">\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 <div *ngIf=\"field?.titleHint\" class=\"govuk-!-margin-left-2\">\n {{ field.titleHint }}\n </div>\n </div>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMinSelectedError && submitted && form.get(field.name).errors?.minLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n <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 <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 *ngIf=\"field.defaultOption\" [attr.selected]=\"true\" [value]=\"field.defaultOption.key\">{{field.defaultOption.label}}</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 disabled selected hidden value=\"\">{{field.disabledText}}</option>\n <option *ngIf=\"field.defaultOption\" selected [value]=\"field.defaultOption.key\">{{field.defaultOption.label}}</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_' + field.name + item.key\"\n [name]=\"'checkbox_' + field.name + item.key\"\n />\n <label\n [for]=\"'checkbox_' + field.name + 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=\"'nested-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 filteredSkillsByServicesCheckbox; 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_' + field.name + item.key\"\n [name]=\"'checkbox_' + field.name + item.key\"\n />\n <label\n [for]=\"'checkbox_' + field.name + 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_' + field.name + item.key\"\n [name]=\"'checkbox_' + field.name + item.key\"\n />\n <label\n [for]=\"'checkbox_' + field.name + 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 [placeholderContent]=\"field.placeholderContent ? field.placeholderContent : ''\"\n [services]=\"form.get(field.servicesField)?.value\"\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 [searchTermLocationForm]=\"searchTermLocationForm\"\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 [field]=\"field\"\n [services]=\"form.get(field.findLocationField)?.value\"\n ></xuilib-find-location>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-task-name'\">\n <xuilib-find-task-name subTitle=\"\" (taskNameSelected)=\"updateTaskNameControls($event, field)\"\n (taskNameFieldChanged)=\"inputChanged(field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"form.get(field.domainField)?.value\"\n [findTaskNameGroup]=\"form\"\n [selectedTaskName]=\"form.get(field.name).value.taskName\"\n [userIncluded]=\"false\"\n ></xuilib-find-task-name>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-service'\">\n <xuilib-find-service (serviceFieldChanged)=\"inputServiceChanged($event, field)\"\n [form]=\"form\"\n [searchTermServiceForm]=\"searchTermServiceForm\"\n [fields]=\"config.fields\"\n [title]=\"field.title\"\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 [readonly]=\"field.readonly\"\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 [readonly]=\"field.readonly\"\n />\n </ng-container>\n </div>\n </div>\n </ng-container>\n</ng-container>\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",
|
|
1030
1081
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1031
1082
|
encapsulation: ViewEncapsulation.None,
|
|
1032
1083
|
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%}"]
|
|
@@ -2533,7 +2584,7 @@ class FindLocationComponent {
|
|
|
2533
2584
|
FindLocationComponent.decorators = [
|
|
2534
2585
|
{ type: Component, args: [{
|
|
2535
2586
|
selector: 'xuilib-find-location',
|
|
2536
|
-
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 <exui-search-location class=\"search-location\"\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\" data-module=\"govuk-button\" *ngIf=\"enableAddLocationButton\">\n Add location\n </a>\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",
|
|
2587
|
+
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 <exui-search-location class=\"search-location\"\n [form]=\"searchTermLocationForm\"\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\" data-module=\"govuk-button\" *ngIf=\"enableAddLocationButton\">\n Add location\n </a>\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",
|
|
2537
2588
|
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}"]
|
|
2538
2589
|
},] }
|
|
2539
2590
|
];
|
|
@@ -2547,6 +2598,7 @@ FindLocationComponent.propDecorators = {
|
|
|
2547
2598
|
fields: [{ type: Input }],
|
|
2548
2599
|
locationTitle: [{ type: Input }],
|
|
2549
2600
|
disableInputField: [{ type: Input }],
|
|
2601
|
+
searchTermLocationForm: [{ type: Input }],
|
|
2550
2602
|
searchLocationComponent: [{ type: ViewChild, args: [SearchLocationComponent, { static: true },] }],
|
|
2551
2603
|
disabled: [{ type: Input }],
|
|
2552
2604
|
services: [{ type: Input }]
|
|
@@ -3153,6 +3205,52 @@ LetDirective.propDecorators = {
|
|
|
3153
3205
|
xuilibLet: [{ type: Input }]
|
|
3154
3206
|
};
|
|
3155
3207
|
|
|
3208
|
+
class SearchServiceComponent {
|
|
3209
|
+
constructor(fb) {
|
|
3210
|
+
this.fb = fb;
|
|
3211
|
+
this.showAutocomplete = false;
|
|
3212
|
+
this.serviceChanged = new EventEmitter();
|
|
3213
|
+
this.minSearchCharacters = 3;
|
|
3214
|
+
this.term = '';
|
|
3215
|
+
this.form = this.fb.group({
|
|
3216
|
+
searchTerm: ['']
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
onInput() {
|
|
3220
|
+
// Todo
|
|
3221
|
+
}
|
|
3222
|
+
resetSearchTerm() {
|
|
3223
|
+
this.form.controls.searchTerm.patchValue('', { emitEvent: false, onlySelf: true });
|
|
3224
|
+
}
|
|
3225
|
+
onSelectionChanged($event) {
|
|
3226
|
+
var _a;
|
|
3227
|
+
const label = (_a = $event.source) === null || _a === void 0 ? void 0 : _a.value;
|
|
3228
|
+
if (label && $event.source.selected) {
|
|
3229
|
+
const selectedService = this.services.find(s => s.label === label);
|
|
3230
|
+
this.serviceChanged.emit(selectedService);
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
SearchServiceComponent.decorators = [
|
|
3235
|
+
{ type: Component, args: [{
|
|
3236
|
+
selector: 'exui-search-service',
|
|
3237
|
+
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)=\"onSelectionChanged($event)\" [value]=\"service.label\">\n {{ service.label }}\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",
|
|
3238
|
+
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:100%;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{box-shadow:0 2px 6px rgba(0,0,0,.256863);left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-left-width:0;border-bottom:1px solid #b1b4b6;border-right-width:0;border-top-width:1px;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{min-width:250px;display:inline-block;margin-right:4px}.autocomplete__input{line-height:24px;font-size:19px}"]
|
|
3239
|
+
},] }
|
|
3240
|
+
];
|
|
3241
|
+
SearchServiceComponent.ctorParameters = () => [
|
|
3242
|
+
{ type: FormBuilder }
|
|
3243
|
+
];
|
|
3244
|
+
SearchServiceComponent.propDecorators = {
|
|
3245
|
+
services: [{ type: Input }],
|
|
3246
|
+
selectedServices: [{ type: Input }],
|
|
3247
|
+
disabled: [{ type: Input }],
|
|
3248
|
+
delay: [{ type: Input }],
|
|
3249
|
+
form: [{ type: Input }],
|
|
3250
|
+
showAutocomplete: [{ type: Input }],
|
|
3251
|
+
serviceChanged: [{ type: Output }]
|
|
3252
|
+
};
|
|
3253
|
+
|
|
3156
3254
|
class FindServiceComponent {
|
|
3157
3255
|
constructor() {
|
|
3158
3256
|
this.services = [];
|
|
@@ -3202,6 +3300,7 @@ class FindServiceComponent {
|
|
|
3202
3300
|
}
|
|
3203
3301
|
this.tempSelectedService = null;
|
|
3204
3302
|
this.serviceFieldChanged.emit(this.tempSelectedService);
|
|
3303
|
+
this.searchServiceComponent.resetSearchTerm();
|
|
3205
3304
|
}
|
|
3206
3305
|
removeService(service) {
|
|
3207
3306
|
if (service.key) {
|
|
@@ -3260,7 +3359,7 @@ class FindServiceComponent {
|
|
|
3260
3359
|
FindServiceComponent.decorators = [
|
|
3261
3360
|
{ type: Component, args: [{
|
|
3262
3361
|
selector: 'xuilib-find-service',
|
|
3263
|
-
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\"\n [services]=\"services\"\n [selectedServices]=\"selectedServices\"\n [delay]=\"300\"\n [disabled]=\"disabled\"\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 *ngIf=\"selection.key!=='All'\" class=\"hmcts-filter__tag\" (click)=\"removeService(selection)\" href=\"javascript:void(0)\">\n {{ selection.label }}\n </a>\n </li>\n </ul>\n</div>\n",
|
|
3362
|
+
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\"\n [services]=\"services\"\n [form]=\"searchTermServiceForm\"\n [selectedServices]=\"selectedServices\"\n [delay]=\"300\"\n [disabled]=\"disabled\"\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 *ngIf=\"selection.key!=='All'\" class=\"hmcts-filter__tag\" (click)=\"removeService(selection)\" href=\"javascript:void(0)\">\n {{ selection.label }}\n </a>\n </li>\n </ul>\n</div>\n",
|
|
3264
3363
|
styles: ["#add-service{background-color:#ddd}"]
|
|
3265
3364
|
},] }
|
|
3266
3365
|
];
|
|
@@ -3269,11 +3368,13 @@ FindServiceComponent.propDecorators = {
|
|
|
3269
3368
|
fields: [{ type: Input }],
|
|
3270
3369
|
serviceTitle: [{ type: Input }],
|
|
3271
3370
|
form: [{ type: Input }],
|
|
3371
|
+
searchTermServiceForm: [{ type: Input }],
|
|
3272
3372
|
services: [{ type: Input }],
|
|
3273
3373
|
selectedServices: [{ type: Input }],
|
|
3274
3374
|
enableAddServiceButton: [{ type: Input }],
|
|
3275
3375
|
disabled: [{ type: Input }],
|
|
3276
3376
|
disableInputField: [{ type: Input }],
|
|
3377
|
+
searchServiceComponent: [{ type: ViewChild, args: [SearchServiceComponent, { static: true },] }],
|
|
3277
3378
|
serviceFieldChanged: [{ type: Output }]
|
|
3278
3379
|
};
|
|
3279
3380
|
|
|
@@ -3400,45 +3501,6 @@ FindTaskNameComponent.propDecorators = {
|
|
|
3400
3501
|
disabled: [{ type: Input }]
|
|
3401
3502
|
};
|
|
3402
3503
|
|
|
3403
|
-
class SearchServiceComponent {
|
|
3404
|
-
constructor(fb) {
|
|
3405
|
-
this.fb = fb;
|
|
3406
|
-
this.showAutocomplete = false;
|
|
3407
|
-
this.serviceChanged = new EventEmitter();
|
|
3408
|
-
this.minSearchCharacters = 3;
|
|
3409
|
-
this.term = '';
|
|
3410
|
-
this.form = this.fb.group({
|
|
3411
|
-
searchTerm: ['']
|
|
3412
|
-
});
|
|
3413
|
-
}
|
|
3414
|
-
onInput() {
|
|
3415
|
-
// Todo
|
|
3416
|
-
}
|
|
3417
|
-
onSelectionChanged(label) {
|
|
3418
|
-
const selectedService = this.services.find(s => s.label === label);
|
|
3419
|
-
this.serviceChanged.emit(selectedService);
|
|
3420
|
-
}
|
|
3421
|
-
}
|
|
3422
|
-
SearchServiceComponent.decorators = [
|
|
3423
|
-
{ type: Component, args: [{
|
|
3424
|
-
selector: 'exui-search-service',
|
|
3425
|
-
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)=\"onSelectionChanged($event.source.value)\" [value]=\"service.label\">\n {{ service.label }}\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",
|
|
3426
|
-
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:100%;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{box-shadow:0 2px 6px rgba(0,0,0,.256863);left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-left-width:0;border-bottom:1px solid #b1b4b6;border-right-width:0;border-top-width:1px;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{min-width:250px;display:inline-block;margin-right:4px}.autocomplete__input{line-height:24px;font-size:19px}"]
|
|
3427
|
-
},] }
|
|
3428
|
-
];
|
|
3429
|
-
SearchServiceComponent.ctorParameters = () => [
|
|
3430
|
-
{ type: FormBuilder }
|
|
3431
|
-
];
|
|
3432
|
-
SearchServiceComponent.propDecorators = {
|
|
3433
|
-
services: [{ type: Input }],
|
|
3434
|
-
selectedServices: [{ type: Input }],
|
|
3435
|
-
disabled: [{ type: Input }],
|
|
3436
|
-
delay: [{ type: Input }],
|
|
3437
|
-
form: [{ type: Input }],
|
|
3438
|
-
showAutocomplete: [{ type: Input }],
|
|
3439
|
-
serviceChanged: [{ type: Output }]
|
|
3440
|
-
};
|
|
3441
|
-
|
|
3442
3504
|
/*
|
|
3443
3505
|
* Gov Uk Checkbox Dumb Component responsible for
|
|
3444
3506
|
* displaying checkbox input and hint
|