@hmcts/rpx-xui-common-lib 1.5.1-location-search-booking → 1.5.5-autocomplete-error
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 +129 -15
- 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-person/find-person.component.js +20 -4
- package/esm2015/lib/components/generic-filter/generic-filter.component.js +2 -2
- package/esm2015/lib/components/search-location/search-location.component.js +11 -2
- package/esm2015/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.js +80 -9
- package/esm2015/lib/models/search-options.model.js +3 -1
- package/esm2015/lib/services/find-person/find-person.service.js +26 -4
- package/esm5/lib/components/find-person/find-person.component.js +20 -4
- package/esm5/lib/components/generic-filter/generic-filter.component.js +2 -2
- package/esm5/lib/components/search-location/search-location.component.js +14 -2
- package/esm5/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.js +94 -8
- package/esm5/lib/models/search-options.model.js +3 -1
- package/esm5/lib/services/find-person/find-person.service.js +26 -4
- package/fesm2015/hmcts-rpx-xui-common-lib.js +114 -16
- package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/fesm5/hmcts-rpx-xui-common-lib.js +131 -15
- package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
- package/lib/components/find-person/find-person.component.d.ts +4 -0
- package/lib/components/search-location/search-location.component.d.ts +4 -2
- package/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.d.ts +8 -0
- package/lib/models/search-options.model.d.ts +1 -0
- package/lib/services/find-person/find-person.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1493,7 +1493,7 @@
|
|
|
1493
1493
|
GenericFilterComponent.decorators = [
|
|
1494
1494
|
{ type: i0.Component, args: [{
|
|
1495
1495
|
selector: 'xuilib-generic-filter',
|
|
1496
|
-
template: "<form [formGroup]=\"form\" (ngSubmit)=\"applyFilter(form)\">\n <div class=\"contain-classes\" *ngFor=\"let field of config.fields\">\n <hr *ngIf=\"field.lineBreakBefore\" class=\"govuk-section-break govuk-section-break--visible elevated-break\">\n <div class=\"govuk-form-group xui-generic-filter\"\n [hidden]=\"hidden(field, form)\"\n [ngClass]=\"{'form-group-error': submitted && (form.get(field.name).errors?.minLength || form.get(field.name).errors?.maxLength)}\">\n <h3 *ngIf=\"field.title\" class=\"govuk-heading-s\">{{field.title}}</h3>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMinSelectedError && submitted && form.get(field.name).errors?.minLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n <div class=\"govuk-body\" [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'select'\">\n <select class=\"govuk-select\" (change)=\"selectChanged(field, form)\" [attr.disabled]=\"disabled(field, form)\" [name]=\"'select_' + field.name\" [id]=\"'select_' + field.name\" [formControlName]=\"field.name\">\n <option disabled selected hidden value=\"\">{{field.disabledText}}</option>\n <option class=\"govuk-radios__item\" *ngFor=\"let item of field.options\" [value]=\"item.key\">{{item.label}}</option>\n </select>\n </ng-container>\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div class=\"govuk-checkboxes govuk-checkboxes--small\" [formGroupName]=\"field.name\" [attr.field]=\"field.name\" [id]=\"'checkbox_' + field.name\">\n <div *ngFor=\"let item of field.options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" class=\"govuk-checkboxes__input\"\n [attr.disabled]=\"disabled(field, form)\"\n [formControlName]=\"i\"\n (change)=\"toggleSelectAll($event, form, item, field)\"\n [value]=\"item.key\" [id]=\"'checkbox_' + item.key\"\n [name]=\"'checkbox_' + item.key\"\n />\n <label\n [for]=\"'checkbox_' + item.key\"\n class=\"govuk-label govuk-checkboxes__label\"\n [ngClass]=\"{'govuk-!-font-weight-bold': item.selectAll}\"\n >{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'radio'\">\n <div class=\"govuk-radios\">\n <div *ngFor=\"let item of field.options\" class=\"govuk-radios__item\">\n <input type=\"radio\"\n [formControlName]=\"field.name\"\n [id]=\"'radio_' + item.key\"\n [attr.disabled]=\"disabled(field, form)\"\n [checked]=\"item.key === form.get(field.name).value\"\n class=\"govuk-radios__input\"\n [value]=\"item.key\"\n (change)=\"radiosChanged(field)\"\n />\n <label [for]=\"'radio_' + item.key\" class=\"govuk-label govuk-radios__label\">{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-person'\">\n <xuilib-find-person subTitle=\"\" (personSelected)=\"updatePersonControls($event, field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"field.domain\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n ></xuilib-find-person>\n </ng-container>\n </div>\n </div>\n </div>\n <hr class=\"govuk-section-break govuk-section-break--m govuk-section-break--visible\"/>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-full\">\n <button\n class=\"govuk-button govuk-!-margin-right-1 govuk-!-margin-bottom-0\"\n type=\"submit\"\n id=\"applyFilter\"\n [disabled]=\"config.enableDisabledButton && form.invalid\"\n >{{config.applyButtonText || 'Apply'}}</button>\n <button\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\"\n type=\"button\"\n id=\"cancelFilter\"\n (click)=\"cancelFilter()\">{{ config.cancelButtonText || 'Cancel'}}</button>\n </div>\n </div>\n</form>\n",
|
|
1496
|
+
template: "<form [formGroup]=\"form\" (ngSubmit)=\"applyFilter(form)\">\n <div class=\"contain-classes\" *ngFor=\"let field of config.fields\">\n <hr *ngIf=\"field.lineBreakBefore\" class=\"govuk-section-break govuk-section-break--visible elevated-break\">\n <div class=\"govuk-form-group xui-generic-filter\"\n [hidden]=\"hidden(field, form)\"\n [ngClass]=\"{'form-group-error': submitted && (form.get(field.name).errors?.minLength || form.get(field.name).errors?.maxLength)}\">\n <h3 *ngIf=\"field.title\" class=\"govuk-heading-s\">{{field.title}}</h3>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMinSelectedError && submitted && form.get(field.name).errors?.minLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n <div class=\"govuk-body\" [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'select'\">\n <select class=\"govuk-select\" (change)=\"selectChanged(field, form)\" [attr.disabled]=\"disabled(field, form)\" [name]=\"'select_' + field.name\" [id]=\"'select_' + field.name\" [formControlName]=\"field.name\">\n <option disabled selected hidden value=\"\">{{field.disabledText}}</option>\n <option class=\"govuk-radios__item\" *ngFor=\"let item of field.options\" [value]=\"item.key\">{{item.label}}</option>\n </select>\n </ng-container>\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div class=\"govuk-checkboxes govuk-checkboxes--small\" [formGroupName]=\"field.name\" [attr.field]=\"field.name\" [id]=\"'checkbox_' + field.name\">\n <div *ngFor=\"let item of field.options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" class=\"govuk-checkboxes__input\"\n [attr.disabled]=\"disabled(field, form)\"\n [formControlName]=\"i\"\n (change)=\"toggleSelectAll($event, form, item, field)\"\n [value]=\"item.key\" [id]=\"'checkbox_' + item.key\"\n [name]=\"'checkbox_' + item.key\"\n />\n <label\n [for]=\"'checkbox_' + item.key\"\n class=\"govuk-label govuk-checkboxes__label\"\n [ngClass]=\"{'govuk-!-font-weight-bold': item.selectAll}\"\n >{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'radio'\">\n <div class=\"govuk-radios\">\n <div *ngFor=\"let item of field.options\" class=\"govuk-radios__item\">\n <input type=\"radio\"\n [formControlName]=\"field.name\"\n [id]=\"'radio_' + item.key\"\n [attr.disabled]=\"disabled(field, form)\"\n [checked]=\"item.key === form.get(field.name).value\"\n class=\"govuk-radios__input\"\n [value]=\"item.key\"\n (change)=\"radiosChanged(field)\"\n />\n <label [for]=\"'radio_' + item.key\" class=\"govuk-label govuk-radios__label\">{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-person'\">\n <xuilib-find-person subTitle=\"\" (personSelected)=\"updatePersonControls($event, field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"field.domain\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n [userIncluded]=\"false\"\n ></xuilib-find-person>\n </ng-container>\n </div>\n </div>\n </div>\n <hr class=\"govuk-section-break govuk-section-break--m govuk-section-break--visible\"/>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-full\">\n <button\n class=\"govuk-button govuk-!-margin-right-1 govuk-!-margin-bottom-0\"\n type=\"submit\"\n id=\"applyFilter\"\n [disabled]=\"config.enableDisabledButton && form.invalid\"\n >{{config.applyButtonText || 'Apply'}}</button>\n <button\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\"\n type=\"button\"\n id=\"cancelFilter\"\n (click)=\"cancelFilter()\">{{ config.cancelButtonText || 'Cancel'}}</button>\n </div>\n </div>\n</form>\n",
|
|
1497
1497
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1498
1498
|
encapsulation: i0.ViewEncapsulation.None,
|
|
1499
1499
|
styles: [".contain-classes .elevated-break{position:relative;top:-10px}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0}"]
|
|
@@ -3647,12 +3647,22 @@
|
|
|
3647
3647
|
this.locationChanged = new i0.EventEmitter();
|
|
3648
3648
|
this.minSearchCharacters = 3;
|
|
3649
3649
|
this.keyUpSubject$ = new rxjs.Subject();
|
|
3650
|
+
this.readyAfterContent = false;
|
|
3650
3651
|
this.findLocationFormGroup = fb.group({
|
|
3651
3652
|
findLocationFormControl: [null],
|
|
3652
3653
|
locationSelectedFormControl: [null]
|
|
3653
3654
|
});
|
|
3654
3655
|
this.selectedLocations$ = rxjs.of([]);
|
|
3655
3656
|
}
|
|
3657
|
+
/**
|
|
3658
|
+
* @return {?}
|
|
3659
|
+
*/
|
|
3660
|
+
SearchLocationComponent.prototype.ngAfterContentInit = /**
|
|
3661
|
+
* @return {?}
|
|
3662
|
+
*/
|
|
3663
|
+
function () {
|
|
3664
|
+
this.readyAfterContent = true;
|
|
3665
|
+
};
|
|
3656
3666
|
/**
|
|
3657
3667
|
* @return {?}
|
|
3658
3668
|
*/
|
|
@@ -3826,7 +3836,7 @@
|
|
|
3826
3836
|
SearchLocationComponent.decorators = [
|
|
3827
3837
|
{ type: i0.Component, args: [{
|
|
3828
3838
|
selector: 'exui-search-location',
|
|
3829
|
-
template: "<div class=\"auto-complete-container\">\n <div class=\"autocomplete__wrapper\">\n <input\n [formControl]=\"findLocationFormGroup.controls.findLocationFormControl\"\n [matAutocomplete]=\"
|
|
3839
|
+
template: "<div class=\"auto-complete-container\">\n <div *ngIf=\"readyAfterContent\" class=\"autocomplete__wrapper\">\n <input\n [formControl]=\"findLocationFormGroup.controls.findLocationFormControl\"\n [matAutocomplete]=\"autoSearchLocation\"\n (keydown)=\"onKeyDown()\"\n (keyup)=\"onKeyUp($event)\"\n class=\"autocomplete__input autocomplete__input--default search-box\"\n [attr.disabled]=\"!disabled ? null: disabled\"\n [value]=\"getControlCourtNameValue()\"\n #inputSelectedLocation>\n <mat-autocomplete class=\"mat-autocomplete-panel-extend\" autoActiveFirstOption #autoSearchLocation=\"matAutocomplete\">\n <mat-option *ngFor=\"let location of locationSource$ | async\"\n [value]=\"getDisplayName(location)\"\n (onSelectionChange)=\"onSelectionChange(location)\"\n [ngClass]=\"{'hide-autocomplete': !showAutocomplete}\">\n {{ getDisplayName(location) }}\n </mat-option>\n <mat-option *ngIf=\"!(locationSource$ | async)?.length && showAutocomplete\">{{ 'No results found' }}</mat-option>\n </mat-autocomplete>\n </div>\n</div>",
|
|
3830
3840
|
styles: [".autocomplete__input{-webkit-appearance:none;border:2px solid #0b0c0c;border-radius:0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin-bottom:0;width:100%;background-color:transparent;position:relative}.autocomplete__hint{color:#b1b4b6;position:absolute}.autocomplete__input--default{padding:5px}.autocomplete__input--focused{outline:#fd0 solid 3px;outline-offset:0;box-shadow:inset 0 0 0 2px}.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: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{min-width:550px;display:inline-block;margin-right:4px}.autocomplete__input{line-height:24px;font-size:19px}"]
|
|
3831
3841
|
}] }
|
|
3832
3842
|
];
|
|
@@ -4258,7 +4268,14 @@
|
|
|
4258
4268
|
* @return {?}
|
|
4259
4269
|
*/
|
|
4260
4270
|
function (searchOptions) {
|
|
4261
|
-
|
|
4271
|
+
/** @type {?} */
|
|
4272
|
+
var userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
4273
|
+
if (userInfoStr && !searchOptions.userIncluded) {
|
|
4274
|
+
/** @type {?} */
|
|
4275
|
+
var userInfo = JSON.parse(userInfoStr);
|
|
4276
|
+
this.userId = userInfo.id ? userInfo.id : userInfo.uid;
|
|
4277
|
+
}
|
|
4278
|
+
return this.http.post('/workallocation2/findPerson', { searchOptions: searchOptions, userId: this.userId });
|
|
4262
4279
|
};
|
|
4263
4280
|
/**
|
|
4264
4281
|
* @param {?} searchOptions
|
|
@@ -4270,6 +4287,13 @@
|
|
|
4270
4287
|
*/
|
|
4271
4288
|
function (searchOptions) {
|
|
4272
4289
|
var _this = this;
|
|
4290
|
+
/** @type {?} */
|
|
4291
|
+
var userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
4292
|
+
if (userInfoStr) {
|
|
4293
|
+
/** @type {?} */
|
|
4294
|
+
var userInfo = JSON.parse(userInfoStr);
|
|
4295
|
+
this.userId = userInfo.id ? userInfo.id : userInfo.uid;
|
|
4296
|
+
}
|
|
4273
4297
|
if (!this.sessionStorageService.getItem(FindAPersonService.caseworkersKey)) {
|
|
4274
4298
|
this.http.get('/workallocation2/caseworker').pipe(operators.tap(( /**
|
|
4275
4299
|
* @param {?} caseworkerList
|
|
@@ -4287,10 +4311,15 @@
|
|
|
4287
4311
|
var people = caseworkers ? this.mapCaseworkers(caseworkers, roleCategory) : [];
|
|
4288
4312
|
/** @type {?} */
|
|
4289
4313
|
var searchTerm = searchOptions && searchOptions.searchTerm ? searchOptions.searchTerm.toLowerCase() : '';
|
|
4290
|
-
|
|
4314
|
+
/** @type {?} */
|
|
4315
|
+
var finalPeopleList = people.filter(( /**
|
|
4291
4316
|
* @param {?} person
|
|
4292
4317
|
* @return {?}
|
|
4293
|
-
*/function (person) { return person && person.name && person.name.toLowerCase().includes(searchTerm); }))
|
|
4318
|
+
*/function (person) { return person && person.name && person.name.toLowerCase().includes(searchTerm); }));
|
|
4319
|
+
return searchOptions.userIncluded ? rxjs.of(finalPeopleList) : rxjs.of(finalPeopleList.filter(( /**
|
|
4320
|
+
* @param {?} person
|
|
4321
|
+
* @return {?}
|
|
4322
|
+
*/function (person) { return person && person.id !== _this.userId; })));
|
|
4294
4323
|
};
|
|
4295
4324
|
/**
|
|
4296
4325
|
* @param {?} caseworkers
|
|
@@ -4353,6 +4382,10 @@
|
|
|
4353
4382
|
this.domain = PersonRole.ALL;
|
|
4354
4383
|
this.submitted = true;
|
|
4355
4384
|
this.disabled = null;
|
|
4385
|
+
this.userIncluded = false;
|
|
4386
|
+
this.placeholderContent = '';
|
|
4387
|
+
this.isNoResultsShown = false;
|
|
4388
|
+
this.showUpdatedColor = false;
|
|
4356
4389
|
this.showAutocomplete = false;
|
|
4357
4390
|
this.findPersonControl = new forms.FormControl();
|
|
4358
4391
|
this.minSearchCharacters = 2;
|
|
@@ -4467,8 +4500,8 @@
|
|
|
4467
4500
|
FindPersonComponent.decorators = [
|
|
4468
4501
|
{ type: i0.Component, args: [{
|
|
4469
4502
|
selector: 'xuilib-find-person',
|
|
4470
|
-
template: "<h1 class=\"govuk-heading-l\" *ngIf=\"title && title.length\">\n <span class=\"govuk-caption-l\">{{title}}</span>\n {{boldTitle}}\n</h1>\n<div class=\"govuk-form-group\" [formGroup]=\"findPersonGroup\"\n [ngClass]=\"{'form-group-error': !findPersonGroup.valid && submitted}\">\n <fieldset class=\"govuk-fieldset\" aria-describedby=\"sub-title-hint\">\n <div id=\"sub-title-hint\" class=\"govuk-hint\" *ngIf=\"subTitle && subTitle.length\">\n {{subTitle}}\n </div>\n <span id=\"validation-error\" class=\"govuk-error-message\" *ngIf=\"findPersonGroup && findPersonGroup.errors\">\n <span class=\"govuk-visually-hidden\">Error:</span>You must select a name\n </span>\n <input id=\"inputSelectPerson\" type=\"text\" aria-label=\"select a person\" matInput\n formControlName=\"findPersonControl\"\n [matAutocomplete]=\"auto\"\n class=\"govuk-input govuk-!-width-one-third\"\n (ngModelChange)=\"updatedVal($event)\"\n [attr.disabled]=\"disabled\"\n [value]=\"selectedPerson\">\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of filteredOptions | async\"\n [value]=\"getDisplayName(option)\"\n (onSelectionChange)=\"onSelectionChange(option)\"\n [ngClass]=\"{'hide-autocomplete': !showAutocomplete}\">\n {{getDisplayName(option)}}\n </mat-option>\n </mat-autocomplete>\n </fieldset>\n</div>\n",
|
|
4471
|
-
styles: [".mat-option:hover{background:#2596be}.hide-autocomplete{display:none}"]
|
|
4503
|
+
template: "<h1 class=\"govuk-heading-l\" *ngIf=\"title && title.length\">\n <span class=\"govuk-caption-l\">{{title}}</span>\n {{boldTitle}}\n</h1>\n<div class=\"govuk-form-group\" [formGroup]=\"findPersonGroup\"\n [ngClass]=\"{'form-group-error': !findPersonGroup.valid && submitted}\">\n <fieldset class=\"govuk-fieldset\" aria-describedby=\"sub-title-hint\">\n <div id=\"sub-title-hint\" class=\"govuk-hint\" *ngIf=\"subTitle && subTitle.length\">\n {{subTitle}}\n </div>\n <span id=\"validation-error\" class=\"govuk-error-message\" *ngIf=\"findPersonGroup && findPersonGroup.errors\">\n <span class=\"govuk-visually-hidden\">Error:</span>You must select a name\n </span>\n <input id=\"inputSelectPerson\" type=\"text\" aria-label=\"select a person\" matInput\n formControlName=\"findPersonControl\"\n [matAutocomplete]=\"auto\"\n class=\"govuk-input govuk-!-width-one-third\"\n (ngModelChange)=\"updatedVal($event)\"\n [placeholder]=\"placeholderContent\"\n [attr.disabled]=\"disabled\"\n [value]=\"selectedPerson\">\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of filteredOptions | async\"\n [value]=\"getDisplayName(option)\"\n (onSelectionChange)=\"onSelectionChange(option)\"\n [ngClass]=\"{'hide-autocomplete': !showAutocomplete, 'select-option': showUpdatedColor}\">\n {{getDisplayName(option)}}\n </mat-option>\n <mat-option [ngClass]=\"{'select-option': showUpdatedColor}\" *ngIf=\"isNoResultsShown && !(filteredOptions | async)?.length && showAutocomplete\">{{ 'No results found' }}</mat-option>\n </mat-autocomplete>\n </fieldset>\n</div>\n",
|
|
4504
|
+
styles: [".mat-option:hover{background:#2596be}.mat-option.select-option:hover{background:#1d70b8;color:#fff}.hide-autocomplete{display:none}"]
|
|
4472
4505
|
}] }
|
|
4473
4506
|
];
|
|
4474
4507
|
/** @nocollapse */
|
|
@@ -4486,7 +4519,11 @@
|
|
|
4486
4519
|
findPersonGroup: [{ type: i0.Input }],
|
|
4487
4520
|
selectedPerson: [{ type: i0.Input }],
|
|
4488
4521
|
submitted: [{ type: i0.Input }],
|
|
4489
|
-
disabled: [{ type: i0.Input }]
|
|
4522
|
+
disabled: [{ type: i0.Input }],
|
|
4523
|
+
userIncluded: [{ type: i0.Input }],
|
|
4524
|
+
placeholderContent: [{ type: i0.Input }],
|
|
4525
|
+
isNoResultsShown: [{ type: i0.Input }],
|
|
4526
|
+
showUpdatedColor: [{ type: i0.Input }]
|
|
4490
4527
|
};
|
|
4491
4528
|
return FindPersonComponent;
|
|
4492
4529
|
}());
|
|
@@ -4568,13 +4605,14 @@
|
|
|
4568
4605
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4569
4606
|
*/
|
|
4570
4607
|
/*
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4608
|
+
* Gov UK Date Component
|
|
4609
|
+
* Responsible for displaying 3 input fields:
|
|
4610
|
+
* day / month / year
|
|
4611
|
+
* displaying errorMessage messages
|
|
4612
|
+
* */
|
|
4576
4613
|
var GovUkDateComponent = /** @class */ (function () {
|
|
4577
4614
|
function GovUkDateComponent() {
|
|
4615
|
+
this.isOptional = false;
|
|
4578
4616
|
}
|
|
4579
4617
|
/**
|
|
4580
4618
|
* @return {?}
|
|
@@ -4583,11 +4621,86 @@
|
|
|
4583
4621
|
* @return {?}
|
|
4584
4622
|
*/
|
|
4585
4623
|
function () {
|
|
4624
|
+
this.day = this.config.id + "_day";
|
|
4625
|
+
this.month = this.config.id + "_month";
|
|
4626
|
+
this.year = this.config.id + "_year";
|
|
4627
|
+
/** @type {?} */
|
|
4628
|
+
var dateValidator = this.DateValidator();
|
|
4629
|
+
this.formGroup.get(this.day).setValidators(dateValidator);
|
|
4630
|
+
};
|
|
4631
|
+
/**
|
|
4632
|
+
* @private
|
|
4633
|
+
* @param {?} d
|
|
4634
|
+
* @param {?} month
|
|
4635
|
+
* @param {?} year
|
|
4636
|
+
* @return {?}
|
|
4637
|
+
*/
|
|
4638
|
+
GovUkDateComponent.prototype.isValidDate = /**
|
|
4639
|
+
* @private
|
|
4640
|
+
* @param {?} d
|
|
4641
|
+
* @param {?} month
|
|
4642
|
+
* @param {?} year
|
|
4643
|
+
* @return {?}
|
|
4644
|
+
*/
|
|
4645
|
+
function (d, month, year) {
|
|
4646
|
+
/** @type {?} */
|
|
4647
|
+
var dateCheck = !isNaN(d.getTime());
|
|
4648
|
+
// Month mismatch occurs if the provided day or month are invalid, or either is omitted. **Note:** This is insufficient for
|
|
4649
|
+
// checking date validity when the year is omitted because it defaults to 1900 - an extra check is required
|
|
4650
|
+
/** @type {?} */
|
|
4651
|
+
var monthMatch = d.getMonth() === month;
|
|
4652
|
+
/** @type {?} */
|
|
4653
|
+
var yearMatch = d.getFullYear() === year;
|
|
4654
|
+
return dateCheck && monthMatch && yearMatch;
|
|
4655
|
+
};
|
|
4656
|
+
/**
|
|
4657
|
+
* @private
|
|
4658
|
+
* @param {?} value
|
|
4659
|
+
* @return {?}
|
|
4660
|
+
*/
|
|
4661
|
+
GovUkDateComponent.prototype.isEmpty = /**
|
|
4662
|
+
* @private
|
|
4663
|
+
* @param {?} value
|
|
4664
|
+
* @return {?}
|
|
4665
|
+
*/
|
|
4666
|
+
function (value) {
|
|
4667
|
+
// Note: Intentional use of == to check for null or undefined
|
|
4668
|
+
/* eslint-disable eqeqeq */
|
|
4669
|
+
/* tslint:disable:triple-equals */
|
|
4670
|
+
// NaN and < 0 checks required for month field
|
|
4671
|
+
return value == null || value === '' || isNaN(value) || value < 0;
|
|
4672
|
+
/* eslint-enable eqeqeq */
|
|
4673
|
+
/* tslint:enable:triple-equals */
|
|
4674
|
+
};
|
|
4675
|
+
/**
|
|
4676
|
+
* @return {?}
|
|
4677
|
+
*/
|
|
4678
|
+
GovUkDateComponent.prototype.DateValidator = /**
|
|
4679
|
+
* @return {?}
|
|
4680
|
+
*/
|
|
4681
|
+
function () {
|
|
4682
|
+
var _this = this;
|
|
4683
|
+
return ( /**
|
|
4684
|
+
* @return {?}
|
|
4685
|
+
*/function () {
|
|
4686
|
+
/** @type {?} */
|
|
4687
|
+
var day = _this.formGroup.get(_this.day).value;
|
|
4688
|
+
/** @type {?} */
|
|
4689
|
+
var month = _this.formGroup.get(_this.month).value - 1;
|
|
4690
|
+
/** @type {?} */
|
|
4691
|
+
var year = _this.formGroup.get(_this.year).value;
|
|
4692
|
+
// Validation should pass if the date field is optional and day, month, and year are all empty
|
|
4693
|
+
if (_this.isOptional && _this.isEmpty(day) && _this.isEmpty(month) && _this.isEmpty(year)) {
|
|
4694
|
+
return null;
|
|
4695
|
+
}
|
|
4696
|
+
// + to coerce year to a number
|
|
4697
|
+
return !_this.isValidDate(new Date(year, month, day), month, +year) ? { dateComponent: true } : null;
|
|
4698
|
+
});
|
|
4586
4699
|
};
|
|
4587
4700
|
GovUkDateComponent.decorators = [
|
|
4588
4701
|
{ type: i0.Component, args: [{
|
|
4589
4702
|
selector: 'xuilib-gov-uk-date',
|
|
4590
|
-
template: "<div class=\"govuk-form-group\" [ngClass]=\"{'govuk-form-group--error': errorMessage?.isInvalid}\" [formGroup]=\"formGroup\">\n <div class=\"date-input-container\">\n <xuilib-gov-uk-fieldset\n [config]=\"{\n legend: config.label || 'Date component',\n classes: config.classes || 'govuk-label--m',\n id: config.id,\n hint: config.hint != null ? config.hint : 'For example, 12 11 2007',\n isPageHeading: config.isPageHeading || false}\"\n [errorMessage]=\"errorMessage\">\n <xuilib-gov-uk-error-message\n [config]=\"{id: 'passport'}\"\n *ngIf=\"errorMessage\"\n [errorMessage]=\"errorMessage\">\n </xuilib-gov-uk-error-message>\n
|
|
4703
|
+
template: "<div class=\"govuk-form-group\" [ngClass]=\"{'govuk-form-group--error': errorMessage?.isInvalid}\" [formGroup]=\"formGroup\">\n <div class=\"date-input-container\">\n <xuilib-gov-uk-fieldset\n [config]=\"{\n legend: config.label || 'Date component',\n classes: config.classes || 'govuk-label--m',\n id: config.id,\n hint: config.hint != null ? config.hint : 'For example, 12 11 2007',\n isPageHeading: config.isPageHeading || false}\"\n [errorMessage]=\"errorMessage\">\n <xuilib-gov-uk-error-message\n [config]=\"{id: 'passport'}\"\n *ngIf=\"errorMessage\"\n [errorMessage]=\"errorMessage\">\n </xuilib-gov-uk-error-message>\n <div class=\"govuk-date-input\" [id]=\"config.id+'-date'\">\n <div class=\"govuk-date-input__item\">\n <div class=\"govuk-form-group\">\n <xuilib-gov-label\n [config]=\"{label: 'Day', name: config.id+'-day', id: config.id+'-day', classes: 'govuk-date-input__label'}\">\n </xuilib-gov-label>\n <input class=\"govuk-input govuk-date-input__input govuk-input--width-2\"\n [ngClass]=\"{'govuk-input--error': errorMessage?.isInvalid}\"\n [id]=\"config.id\"\n [name]=\"config.id+'-day'\" type=\"number\" value=\"\" pattern=\"[0-9]*\"\n [formControlName]=\"config.id+'_day'\">\n </div>\n </div>\n <div class=\"govuk-date-input__item\">\n <div class=\"govuk-form-group\">\n <xuilib-gov-label\n [config]=\"{label: 'Month', name: config.id+'-month', id: config.id+'-month', classes: 'govuk-date-input__label'}\">\n </xuilib-gov-label>\n <input class=\"govuk-input govuk-date-input__input govuk-input--width-2\"\n [ngClass]=\"{'govuk-input--error': errorMessage?.isInvalid}\"\n [id]=\"config.id+'-month'\"\n [name]=\"config.id+'-month'\" type=\"number\" value=\"\" pattern=\"[0-9]*\"\n [formControlName]=\"config.id+'_month'\">\n </div>\n </div>\n <div class=\"govuk-date-input__item\">\n <div class=\"govuk-form-group\">\n <xuilib-gov-label\n [config]=\"{label: 'Year', name: config.id+'-year', id: config.id+'-year', classes: 'govuk-date-input__label'}\">\n </xuilib-gov-label>\n <input class=\"govuk-input govuk-date-input__input govuk-input--width-4\"\n [ngClass]=\"{'govuk-input--error': errorMessage?.isInvalid}\"\n [id]=\"config.id+'-year'\"\n [name]=\"config.id+'-year'\" type=\"number\" value=\"\" pattern=\"[0-9]*\"\n [formControlName]=\"config.id+'_year'\">\n </div>\n </div>\n </div>\n </xuilib-gov-uk-fieldset>\n </div>\n</div>\n",
|
|
4591
4704
|
styles: [".govuk-form-group .date-input-container{margin-bottom:30px}.govuk-form-group .date-input-container .govuk-date-input .govuk-date-input__item .govuk-form-group{margin-bottom:0}"]
|
|
4592
4705
|
}] }
|
|
4593
4706
|
];
|
|
@@ -4596,7 +4709,8 @@
|
|
|
4596
4709
|
GovUkDateComponent.propDecorators = {
|
|
4597
4710
|
config: [{ type: i0.Input }],
|
|
4598
4711
|
errorMessage: [{ type: i0.Input }],
|
|
4599
|
-
formGroup: [{ type: i0.Input }]
|
|
4712
|
+
formGroup: [{ type: i0.Input }],
|
|
4713
|
+
isOptional: [{ type: i0.Input }]
|
|
4600
4714
|
};
|
|
4601
4715
|
return GovUkDateComponent;
|
|
4602
4716
|
}());
|