@hmcts/rpx-xui-common-lib 1.4.24-search-location-selection-accessibility-pristine-fixes → 1.4.29-date-component-common-validation
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 +64 -14
- 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/search-location/search-location.component.js +4 -9
- package/esm2015/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.js +63 -8
- package/esm5/lib/components/search-location/search-location.component.js +4 -9
- package/esm5/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.js +73 -8
- package/fesm2015/hmcts-rpx-xui-common-lib.js +55 -14
- package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/fesm5/hmcts-rpx-xui-common-lib.js +66 -15
- package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/hmcts-rpx-xui-common-lib.metadata.json +1 -1
- package/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.d.ts +7 -0
- package/package.json +1 -1
|
@@ -3762,10 +3762,6 @@
|
|
|
3762
3762
|
*/
|
|
3763
3763
|
function (currentValue) {
|
|
3764
3764
|
this.showAutocomplete = !!currentValue && (currentValue.length >= this.minSearchCharacters);
|
|
3765
|
-
if (!currentValue || !currentValue.length) {
|
|
3766
|
-
this.findLocationFormGroup.controls.locationSelectedFormControl.markAsPristine();
|
|
3767
|
-
this.findLocationFormGroup.controls.locationSelectedFormControl.reset();
|
|
3768
|
-
}
|
|
3769
3765
|
if (this.showAutocomplete) {
|
|
3770
3766
|
this.filter(currentValue);
|
|
3771
3767
|
}
|
|
@@ -3805,8 +3801,8 @@
|
|
|
3805
3801
|
SearchLocationComponent.decorators = [
|
|
3806
3802
|
{ type: i0.Component, args: [{
|
|
3807
3803
|
selector: 'exui-search-location',
|
|
3808
|
-
template: "<div class=\"auto-complete-container\">\n <div class=\"autocomplete__wrapper\"> \n <input \n [formControl]=\"findLocationFormGroup.controls.findLocationFormControl\"\n [matAutocomplete]=\"auto\"\n (keyup)=\"onKeyUp($event)\"\n aria-expanded=\"false\" \n aria-owns=\"input-selected-location__listbox\" \n aria-autocomplete=\"both\" \n autocomplete=\"off\" \n class=\"autocomplete__input autocomplete__input--default search-box\"\n [attr.disabled]=\"!disabled ? null: disabled\"\n [value]=\"getControlCourtNameValue()\"\n id=\"input-selected-location\">\n <mat-autocomplete class=\"mat-autocomplete-panel-extend\" autoActiveFirstOption #auto=\"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
|
|
3809
|
-
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:16px;line-height:1.25}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:19px;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:50%;display:inline-block;margin-right:4px}
|
|
3804
|
+
template: "<div class=\"auto-complete-container\">\n <div class=\"autocomplete__wrapper\"> \n <input \n [formControl]=\"findLocationFormGroup.controls.findLocationFormControl\"\n [matAutocomplete]=\"auto\"\n (keyup)=\"onKeyUp($event)\"\n aria-expanded=\"false\" \n aria-owns=\"input-selected-location__listbox\" \n aria-autocomplete=\"both\" \n autocomplete=\"off\" \n class=\"autocomplete__input autocomplete__input--default search-box\"\n [attr.disabled]=\"!disabled ? null: disabled\"\n [value]=\"getControlCourtNameValue()\"\n id=\"input-selected-location\">\n <mat-autocomplete class=\"mat-autocomplete-panel-extend\" autoActiveFirstOption #auto=\"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-autocomplete>\n </div>\n</div>\n",
|
|
3805
|
+
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:16px;line-height:1.25}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:19px;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:50%;display:inline-block;margin-right:4px}"]
|
|
3810
3806
|
}] }
|
|
3811
3807
|
];
|
|
3812
3808
|
/** @nocollapse */
|
|
@@ -3822,8 +3818,7 @@
|
|
|
3822
3818
|
locationType: [{ type: i0.Input }],
|
|
3823
3819
|
selectedLocations$: [{ type: i0.Input }],
|
|
3824
3820
|
serviceIds: [{ type: i0.Input }],
|
|
3825
|
-
submitted: [{ type: i0.Input }]
|
|
3826
|
-
locations$: [{ type: i0.Input }]
|
|
3821
|
+
submitted: [{ type: i0.Input }]
|
|
3827
3822
|
};
|
|
3828
3823
|
return SearchLocationComponent;
|
|
3829
3824
|
}());
|
|
@@ -4544,11 +4539,11 @@
|
|
|
4544
4539
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4545
4540
|
*/
|
|
4546
4541
|
/*
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4542
|
+
* Gov UK Date Component
|
|
4543
|
+
* Responsible for displaying 3 input fields:
|
|
4544
|
+
* day / month / year
|
|
4545
|
+
* displaying errorMessage messages
|
|
4546
|
+
* */
|
|
4552
4547
|
var GovUkDateComponent = /** @class */ (function () {
|
|
4553
4548
|
function GovUkDateComponent() {
|
|
4554
4549
|
}
|
|
@@ -4559,17 +4554,72 @@
|
|
|
4559
4554
|
* @return {?}
|
|
4560
4555
|
*/
|
|
4561
4556
|
function () {
|
|
4557
|
+
this.day = this.config.id + "_day";
|
|
4558
|
+
this.month = this.config.id + "_month";
|
|
4559
|
+
this.year = this.config.id + "_year";
|
|
4560
|
+
/** @type {?} */
|
|
4561
|
+
var dateValidator = this.DateValidator();
|
|
4562
|
+
this.formGroup.get(this.day).setValidators(dateValidator);
|
|
4563
|
+
};
|
|
4564
|
+
/**
|
|
4565
|
+
* @private
|
|
4566
|
+
* @param {?} d
|
|
4567
|
+
* @param {?} month
|
|
4568
|
+
* @return {?}
|
|
4569
|
+
*/
|
|
4570
|
+
GovUkDateComponent.prototype.isValidDate = /**
|
|
4571
|
+
* @private
|
|
4572
|
+
* @param {?} d
|
|
4573
|
+
* @param {?} month
|
|
4574
|
+
* @return {?}
|
|
4575
|
+
*/
|
|
4576
|
+
function (d, month) {
|
|
4577
|
+
/** @type {?} */
|
|
4578
|
+
var dateCheck = d instanceof Date && !isNaN(d.getTime());
|
|
4579
|
+
/** @type {?} */
|
|
4580
|
+
var leapYearCheck = d.getMonth() === month;
|
|
4581
|
+
return dateCheck && leapYearCheck;
|
|
4582
|
+
};
|
|
4583
|
+
/**
|
|
4584
|
+
* @return {?}
|
|
4585
|
+
*/
|
|
4586
|
+
GovUkDateComponent.prototype.DateValidator = /**
|
|
4587
|
+
* @return {?}
|
|
4588
|
+
*/
|
|
4589
|
+
function () {
|
|
4590
|
+
var _this = this;
|
|
4591
|
+
/** @type {?} */
|
|
4592
|
+
var res = ( /**
|
|
4593
|
+
* @return {?}
|
|
4594
|
+
*/function () {
|
|
4595
|
+
/** @type {?} */
|
|
4596
|
+
var day = _this.formGroup.get(_this.day).value;
|
|
4597
|
+
/** @type {?} */
|
|
4598
|
+
var month = _this.formGroup.get(_this.month).value - 1;
|
|
4599
|
+
/** @type {?} */
|
|
4600
|
+
var year = _this.formGroup.get(_this.year).value;
|
|
4601
|
+
/** @type {?} */
|
|
4602
|
+
var isValid = _this.isValidDate(new Date(year, month, day), month);
|
|
4603
|
+
if (!isValid) {
|
|
4604
|
+
return { isValid: false, errorType: 'DATE_VALIDATION_FAILED' };
|
|
4605
|
+
}
|
|
4606
|
+
else {
|
|
4607
|
+
return;
|
|
4608
|
+
}
|
|
4609
|
+
});
|
|
4610
|
+
return res;
|
|
4562
4611
|
};
|
|
4563
4612
|
GovUkDateComponent.decorators = [
|
|
4564
4613
|
{ type: i0.Component, args: [{
|
|
4565
4614
|
selector: 'xuilib-gov-uk-date',
|
|
4566
|
-
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
|
|
4615
|
+
template: "<div #form=\"ngForm\" 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",
|
|
4567
4616
|
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}"]
|
|
4568
4617
|
}] }
|
|
4569
4618
|
];
|
|
4570
4619
|
/** @nocollapse */
|
|
4571
4620
|
GovUkDateComponent.ctorParameters = function () { return []; };
|
|
4572
4621
|
GovUkDateComponent.propDecorators = {
|
|
4622
|
+
form: [{ type: i0.ViewChild, args: ['form',] }],
|
|
4573
4623
|
config: [{ type: i0.Input }],
|
|
4574
4624
|
errorMessage: [{ type: i0.Input }],
|
|
4575
4625
|
formGroup: [{ type: i0.Input }]
|