@tedi-design-system/angular 6.4.0-rc.6 → 6.4.0-rc.7

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.
@@ -5031,6 +5031,38 @@ class SelectComponent {
5031
5031
  * Receives the search term and the option item (with all original properties), returns true to include the option.
5032
5032
  */
5033
5033
  searchFn = input();
5034
+ /**
5035
+ * Whether to clear the search input after an option is selected.
5036
+ * Only has a visible effect in multi-select mode — in single-select mode
5037
+ * the dropdown closes on selection, which already clears the search term.
5038
+ * @default false
5039
+ */
5040
+ clearSearchOnSelect = input(false);
5041
+ /**
5042
+ * Emits whenever the selection changes from any source: option click,
5043
+ * tag removal, clear button, select-all, or group toggle.
5044
+ * Payload is the array of selected values in multi-select mode, or the
5045
+ * single selected value (or `null`) in single-select mode.
5046
+ */
5047
+ selectionChange = output();
5048
+ /**
5049
+ * Emits the current search term whenever the user types in the search input.
5050
+ * Only fires when `searchable` is `true`.
5051
+ */
5052
+ searchChange = output();
5053
+ /**
5054
+ * Emits when the dropdown panel opens.
5055
+ */
5056
+ opened = output();
5057
+ /**
5058
+ * Emits when the dropdown panel closes.
5059
+ */
5060
+ closed = output();
5061
+ /**
5062
+ * Emits when the user clicks the clear button.
5063
+ * Fires alongside `selectionChange`, which carries the new (empty) value.
5064
+ */
5065
+ cleared = output();
5034
5066
  SpecialOptionControls = SpecialOptionControls;
5035
5067
  dropdownPositions = [
5036
5068
  // Open below, expand downward
@@ -5199,8 +5231,7 @@ class SelectComponent {
5199
5231
  const listboxElement = this.listboxRef()?.nativeElement;
5200
5232
  const clickedInside = hostElement.contains(target) || listboxElement?.contains(target);
5201
5233
  if (!clickedInside) {
5202
- this.isOpen.set(false);
5203
- this.searchTerm.set("");
5234
+ this.closeDropdown();
5204
5235
  }
5205
5236
  }
5206
5237
  focusListboxWhenVisible = effect(() => {
@@ -5252,6 +5283,7 @@ class SelectComponent {
5252
5283
  onSearchInput(event) {
5253
5284
  const input = event.target;
5254
5285
  this.searchTerm.set(input.value);
5286
+ this.searchChange.emit(input.value);
5255
5287
  if (!this.isOpen()) {
5256
5288
  this.openDropdown();
5257
5289
  }
@@ -5340,8 +5372,11 @@ class SelectComponent {
5340
5372
  }
5341
5373
  }
5342
5374
  openDropdown() {
5375
+ if (this.isOpen())
5376
+ return;
5343
5377
  this.calculateDropdownMaxHeight();
5344
5378
  this.isOpen.set(true);
5379
+ this.opened.emit();
5345
5380
  }
5346
5381
  calculateDropdownMaxHeight() {
5347
5382
  const inputMaxHeight = this.maxDropdownHeight();
@@ -5365,9 +5400,12 @@ class SelectComponent {
5365
5400
  this.dropdownMaxHeight.set(maxHeight);
5366
5401
  }
5367
5402
  closeDropdown() {
5403
+ if (!this.isOpen())
5404
+ return;
5368
5405
  this.isOpen.set(false);
5369
5406
  this.searchTerm.set("");
5370
5407
  this.dropdownMaxHeight.set(null);
5408
+ this.closed.emit();
5371
5409
  }
5372
5410
  handleValueChange(event) {
5373
5411
  const values = event.value;
@@ -5398,6 +5436,10 @@ class SelectComponent {
5398
5436
  }
5399
5437
  this.selectedValues.set(newSelection);
5400
5438
  this.onChange(newSelection);
5439
+ this.selectionChange.emit(newSelection);
5440
+ if (this.clearSearchOnSelect()) {
5441
+ this.searchTerm.set("");
5442
+ }
5401
5443
  if (this.searchable()) {
5402
5444
  this.searchInputRef()?.nativeElement.focus();
5403
5445
  }
@@ -5406,6 +5448,10 @@ class SelectComponent {
5406
5448
  const selected = values[0] ?? null;
5407
5449
  this.selectedValues.set(selected != null ? [selected] : []);
5408
5450
  this.onChange(selected);
5451
+ this.selectionChange.emit(selected);
5452
+ if (this.clearSearchOnSelect()) {
5453
+ this.searchTerm.set("");
5454
+ }
5409
5455
  this.toggleIsOpen(true);
5410
5456
  }
5411
5457
  this.onTouched();
@@ -5417,10 +5463,13 @@ class SelectComponent {
5417
5463
  this.selectedValues.set([]);
5418
5464
  if (this.allowMultiple()) {
5419
5465
  this.onChange([]);
5466
+ this.selectionChange.emit([]);
5420
5467
  }
5421
5468
  else {
5422
5469
  this.onChange(null);
5470
+ this.selectionChange.emit(null);
5423
5471
  }
5472
+ this.cleared.emit();
5424
5473
  this.onTouched();
5425
5474
  this.focusTrigger();
5426
5475
  }
@@ -5433,6 +5482,7 @@ class SelectComponent {
5433
5482
  const newSelection = this.selectedValues().filter((v) => !compareWith(v, value));
5434
5483
  this.selectedValues.set(newSelection);
5435
5484
  this.onChange(newSelection);
5485
+ this.selectionChange.emit(newSelection);
5436
5486
  this.onTouched();
5437
5487
  }
5438
5488
  isOptionSelected(optionValue) {
@@ -5583,6 +5633,7 @@ class SelectComponent {
5583
5633
  const newSelection = this.selectedValues().filter((val) => !enabledOptions.some((o) => compareWith(val, o.value)));
5584
5634
  this.selectedValues.set(newSelection);
5585
5635
  this.onChange(newSelection);
5636
+ this.selectionChange.emit(newSelection);
5586
5637
  }
5587
5638
  else {
5588
5639
  // Select: add visible enabled options to current selection
@@ -5594,6 +5645,7 @@ class SelectComponent {
5594
5645
  }
5595
5646
  this.selectedValues.set(newSelection);
5596
5647
  this.onChange(newSelection);
5648
+ this.selectionChange.emit(newSelection);
5597
5649
  }
5598
5650
  }
5599
5651
  toggleGroupSelection(groupLabel) {
@@ -5618,6 +5670,7 @@ class SelectComponent {
5618
5670
  }
5619
5671
  this.selectedValues.set(newSelection);
5620
5672
  this.onChange(newSelection);
5673
+ this.selectionChange.emit(newSelection);
5621
5674
  }
5622
5675
  onChange = () => { };
5623
5676
  onTouched = () => { };
@@ -5642,7 +5695,7 @@ class SelectComponent {
5642
5695
  }
5643
5696
  }
5644
5697
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5645
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: SelectComponent, isStandalone: true, selector: "tedi-select", inputs: { inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, dropdownWidthRef: { classPropertyName: "dropdownWidthRef", publicName: "dropdownWidthRef", isSignal: true, isRequired: false, transformFunction: null }, feedbackText: { classPropertyName: "feedbackText", publicName: "feedbackText", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, bindLabel: { classPropertyName: "bindLabel", publicName: "bindLabel", isSignal: true, isRequired: false, transformFunction: null }, bindValue: { classPropertyName: "bindValue", publicName: "bindValue", isSignal: true, isRequired: false, transformFunction: null }, allowMultiple: { classPropertyName: "allowMultiple", publicName: "allowMultiple", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, showSelectAll: { classPropertyName: "showSelectAll", publicName: "showSelectAll", isSignal: true, isRequired: false, transformFunction: null }, selectableGroups: { classPropertyName: "selectableGroups", publicName: "selectableGroups", isSignal: true, isRequired: false, transformFunction: null }, isTagRemovable: { classPropertyName: "isTagRemovable", publicName: "isTagRemovable", isSignal: true, isRequired: false, transformFunction: null }, multiRow: { classPropertyName: "multiRow", publicName: "multiRow", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, disabledKey: { classPropertyName: "disabledKey", publicName: "disabledKey", isSignal: true, isRequired: false, transformFunction: null }, noOptionsMessage: { classPropertyName: "noOptionsMessage", publicName: "noOptionsMessage", isSignal: true, isRequired: false, transformFunction: null }, maxDropdownHeight: { classPropertyName: "maxDropdownHeight", publicName: "maxDropdownHeight", isSignal: true, isRequired: false, transformFunction: null }, dropdownType: { classPropertyName: "dropdownType", publicName: "dropdownType", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, searchFn: { classPropertyName: "searchFn", publicName: "searchFn", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:resize": "onWindowResize()", "document:click": "onDocumentClick($event)" }, properties: { "class.tedi-select--multiselect": "allowMultiple()" }, classAttribute: "tedi-select" }, providers: [
5698
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: SelectComponent, isStandalone: true, selector: "tedi-select", inputs: { inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, dropdownWidthRef: { classPropertyName: "dropdownWidthRef", publicName: "dropdownWidthRef", isSignal: true, isRequired: false, transformFunction: null }, feedbackText: { classPropertyName: "feedbackText", publicName: "feedbackText", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, bindLabel: { classPropertyName: "bindLabel", publicName: "bindLabel", isSignal: true, isRequired: false, transformFunction: null }, bindValue: { classPropertyName: "bindValue", publicName: "bindValue", isSignal: true, isRequired: false, transformFunction: null }, allowMultiple: { classPropertyName: "allowMultiple", publicName: "allowMultiple", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, showSelectAll: { classPropertyName: "showSelectAll", publicName: "showSelectAll", isSignal: true, isRequired: false, transformFunction: null }, selectableGroups: { classPropertyName: "selectableGroups", publicName: "selectableGroups", isSignal: true, isRequired: false, transformFunction: null }, isTagRemovable: { classPropertyName: "isTagRemovable", publicName: "isTagRemovable", isSignal: true, isRequired: false, transformFunction: null }, multiRow: { classPropertyName: "multiRow", publicName: "multiRow", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, disabledKey: { classPropertyName: "disabledKey", publicName: "disabledKey", isSignal: true, isRequired: false, transformFunction: null }, noOptionsMessage: { classPropertyName: "noOptionsMessage", publicName: "noOptionsMessage", isSignal: true, isRequired: false, transformFunction: null }, maxDropdownHeight: { classPropertyName: "maxDropdownHeight", publicName: "maxDropdownHeight", isSignal: true, isRequired: false, transformFunction: null }, dropdownType: { classPropertyName: "dropdownType", publicName: "dropdownType", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, searchFn: { classPropertyName: "searchFn", publicName: "searchFn", isSignal: true, isRequired: false, transformFunction: null }, clearSearchOnSelect: { classPropertyName: "clearSearchOnSelect", publicName: "clearSearchOnSelect", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange", searchChange: "searchChange", opened: "opened", closed: "closed", cleared: "cleared" }, host: { listeners: { "window:resize": "onWindowResize()", "document:click": "onDocumentClick($event)" }, properties: { "class.tedi-select--multiselect": "allowMultiple()" }, classAttribute: "tedi-select" }, providers: [
5646
5699
  {
5647
5700
  provide: NG_VALUE_ACCESSOR,
5648
5701
  useExisting: forwardRef(() => SelectComponent),