@danske/sapphire-angular 1.17.1 → 1.18.0

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.
@@ -4217,10 +4217,13 @@ class SearchableSelectDirective {
4217
4217
  }
4218
4218
  }
4219
4219
  SearchableSelectDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: SearchableSelectDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4220
- SearchableSelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: SearchableSelectDirective, selector: "sp-select[searchable]", inputs: { searchValue: "searchValue", filter: "filter", selectTextOnOpen: "selectTextOnOpen" }, outputs: { searchValueChange: "searchValueChange" }, ngImport: i0 });
4220
+ SearchableSelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.0", type: SearchableSelectDirective, selector: "sp-select[searchable]", inputs: { searchValue: "searchValue", filter: "filter", selectTextOnOpen: "selectTextOnOpen", clearSearchOnOpen: "clearSearchOnOpen" }, outputs: { searchValueChange: "searchValueChange" }, ngImport: i0 });
4221
4221
  __decorate([
4222
4222
  CoerceBoolean
4223
4223
  ], SearchableSelectDirective.prototype, "selectTextOnOpen", void 0);
4224
+ __decorate([
4225
+ CoerceBoolean
4226
+ ], SearchableSelectDirective.prototype, "clearSearchOnOpen", void 0);
4224
4227
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: SearchableSelectDirective, decorators: [{
4225
4228
  type: Directive,
4226
4229
  args: [{
@@ -4232,6 +4235,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
4232
4235
  type: Input
4233
4236
  }], selectTextOnOpen: [{
4234
4237
  type: Input
4238
+ }], clearSearchOnOpen: [{
4239
+ type: Input
4235
4240
  }], searchValueChange: [{
4236
4241
  type: Output
4237
4242
  }] } });
@@ -4501,7 +4506,9 @@ class SelectComponent extends SelectComponentBase {
4501
4506
  _onOpen() {
4502
4507
  super._onOpen();
4503
4508
  if (!this.multiple && this._searchableSelectDirective) {
4504
- this._searchableSelectDirective.setSearchValue(this.selectedOptions[0]?.label || '');
4509
+ this._searchableSelectDirective.setSearchValue((this._searchableSelectDirective.clearSearchOnOpen
4510
+ ? ''
4511
+ : this.selectedOptions[0]?.label) ?? '');
4505
4512
  }
4506
4513
  const searchInputElement = this.searchInput?.nativeElement;
4507
4514
  if (this._searchableSelectDirective?.selectTextOnOpen) {
@@ -4521,6 +4528,9 @@ class SelectComponent extends SelectComponentBase {
4521
4528
  }
4522
4529
  _onClose() {
4523
4530
  super._onClose();
4531
+ if (!this.multiple && this._searchableSelectDirective) {
4532
+ this._searchableSelectDirective.setSearchValue(this.selectedOptions[0]?.label || '');
4533
+ }
4524
4534
  const searchInputElement = this.searchInput?.nativeElement;
4525
4535
  searchInputElement?.setSelectionRange(searchInputElement.value.length, searchInputElement.value.length);
4526
4536
  }