@hmcts/rpx-xui-common-lib 1.4.29-date-component-common-validation → 1.4.30-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.
@@ -979,7 +979,9 @@ var GenericFilterComponent = /** @class */ (function () {
979
979
  fields: this.getSelectedValues(form.value, this.config)
980
980
  };
981
981
  this.filterService.givenErrors.next(null);
982
- this.filterService.persist(this.settings, this.config.persistence);
982
+ /** @type {?} */
983
+ var settings = __assign({}, this.settings, { reset: false });
984
+ this.filterService.persist(settings, this.config.persistence);
983
985
  }
984
986
  else {
985
987
  this.emitFormErrors(form);
@@ -1055,7 +1057,9 @@ var GenericFilterComponent = /** @class */ (function () {
1055
1057
  if (this.config && this.config.cancelSetting) {
1056
1058
  this._settings.fields = JSON.parse(JSON.stringify(this.config.cancelSetting.fields));
1057
1059
  }
1058
- this.filterService.persist(this.settings, this.config.persistence);
1060
+ /** @type {?} */
1061
+ var settings = __assign({}, this.settings, { reset: true });
1062
+ this.filterService.persist(settings, this.config.persistence);
1059
1063
  this.filterService.givenErrors.next(null);
1060
1064
  };
1061
1065
  /**
@@ -3608,7 +3612,7 @@ var SearchLocationComponent = /** @class */ (function () {
3608
3612
  * @param {?} selectedLocation
3609
3613
  * @return {?}
3610
3614
  */
3611
- function (selectedLocation) { return selectedLocation.epims_id; })).includes(location.epims_id); })); }))); }))) : of([]);
3615
+ function (selectedLocation) { return selectedLocation.epims_id; })).includes(location.epims_id) && location.court_name; })); }))); }))) : of([]);
3612
3616
  },
3613
3617
  enumerable: true,
3614
3618
  configurable: true
@@ -3668,6 +3672,10 @@ var SearchLocationComponent = /** @class */ (function () {
3668
3672
  */
3669
3673
  function (currentValue) {
3670
3674
  this.showAutocomplete = !!currentValue && (currentValue.length >= this.minSearchCharacters);
3675
+ if (!currentValue || !currentValue.length) {
3676
+ this.findLocationFormGroup.controls.locationSelectedFormControl.markAsPristine();
3677
+ this.findLocationFormGroup.controls.locationSelectedFormControl.reset();
3678
+ }
3671
3679
  if (this.showAutocomplete) {
3672
3680
  this.filter(currentValue);
3673
3681
  }
@@ -3707,8 +3715,8 @@ var SearchLocationComponent = /** @class */ (function () {
3707
3715
  SearchLocationComponent.decorators = [
3708
3716
  { type: Component, args: [{
3709
3717
  selector: 'exui-search-location',
3710
- 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",
3711
- 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}"]
3718
+ 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 #inputSelectedLocation>\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-option *ngIf=\"!(locationSource$ | async)?.length && showAutocomplete\">{{ 'No results found' }}</mat-option>\n </mat-autocomplete>\n </div>\n</div>\n",
3719
+ 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}"]
3712
3720
  }] }
3713
3721
  ];
3714
3722
  /** @nocollapse */
@@ -3722,7 +3730,9 @@ var SearchLocationComponent = /** @class */ (function () {
3722
3730
  locationType: [{ type: Input }],
3723
3731
  selectedLocations$: [{ type: Input }],
3724
3732
  serviceIds: [{ type: Input }],
3725
- submitted: [{ type: Input }]
3733
+ submitted: [{ type: Input }],
3734
+ autoCompleteInputBox: [{ type: ViewChild, args: ['inputSelectedLocation', { read: ElementRef },] }],
3735
+ locations$: [{ type: Input }]
3726
3736
  };
3727
3737
  return SearchLocationComponent;
3728
3738
  }());
@@ -4558,26 +4568,20 @@ var GovUkDateComponent = /** @class */ (function () {
4558
4568
  var year = _this.formGroup.get(_this.year).value;
4559
4569
  /** @type {?} */
4560
4570
  var isValid = _this.isValidDate(new Date(year, month, day), month);
4561
- if (!isValid) {
4562
- return { isValid: false, errorType: 'DATE_VALIDATION_FAILED' };
4563
- }
4564
- else {
4565
- return;
4566
- }
4571
+ return !isValid ? { dateComponent: true } : null;
4567
4572
  });
4568
4573
  return res;
4569
4574
  };
4570
4575
  GovUkDateComponent.decorators = [
4571
4576
  { type: Component, args: [{
4572
4577
  selector: 'xuilib-gov-uk-date',
4573
- 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",
4578
+ 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",
4574
4579
  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}"]
4575
4580
  }] }
4576
4581
  ];
4577
4582
  /** @nocollapse */
4578
4583
  GovUkDateComponent.ctorParameters = function () { return []; };
4579
4584
  GovUkDateComponent.propDecorators = {
4580
- form: [{ type: ViewChild, args: ['form',] }],
4581
4585
  config: [{ type: Input }],
4582
4586
  errorMessage: [{ type: Input }],
4583
4587
  formGroup: [{ type: Input }]