ngx-tethys 19.1.4 → 19.1.6

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.
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, inject, ViewContainerRef, effect, Directive, ElementRef, NgZone, Renderer2, output, computed, ContentChildren, KeyValueDiffers, linkedSignal, TemplateRef, untracked, ChangeDetectorRef, NgModule, Input, model, signal, numberAttribute, viewChild, ChangeDetectionStrategy, Component, InjectionToken, HostListener, ViewEncapsulation } from '@angular/core';
2
+ import { input, inject, ViewContainerRef, effect, Directive, ElementRef, NgZone, Renderer2, output, computed, ContentChildren, KeyValueDiffers, linkedSignal, TemplateRef, untracked, ChangeDetectorRef, NgModule, Input, DestroyRef, model, signal, numberAttribute, viewChild, ChangeDetectionStrategy, Component, InjectionToken, HostListener, ViewEncapsulation } from '@angular/core';
3
3
  import { reqAnimFrame, TabIndexDisabledControlValueAccessorMixin, ThyTranslate, mixinDisabled, MixinBase } from 'ngx-tethys/core';
4
- import { coerceBooleanProperty, keycodes, isTemplateRef, isUndefinedOrNull, ENTER, SPACE, hasModifierKey } from 'ngx-tethys/util';
4
+ import { coerceBooleanProperty, keycodes, isTemplateRef, isUndefinedOrNull, coerceArray, ENTER, SPACE, hasModifierKey } from 'ngx-tethys/util';
5
5
  import { useHostRenderer } from '@tethys/cdk/dom';
6
- import { Subject, Observable, fromEvent, merge, defer } from 'rxjs';
6
+ import { Subject, Observable, fromEvent, merge, throttleTime, of, defer } from 'rxjs';
7
7
  import { startWith, switchMap, takeUntil, take, debounceTime, map } from 'rxjs/operators';
8
8
  import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
9
9
  import { CdkDrag } from '@angular/cdk/drag-drop';
@@ -12,11 +12,12 @@ import { ThyTag, ThyTagModule } from 'ngx-tethys/tag';
12
12
  import { NgClass, NgStyle, NgTemplateOutlet, CommonModule } from '@angular/common';
13
13
  import * as i1 from '@angular/forms';
14
14
  import { FormsModule } from '@angular/forms';
15
+ import { takeUntilDestroyed, outputToObservable } from '@angular/core/rxjs-interop';
16
+ import { ThyFlexibleText } from 'ngx-tethys/flexible-text';
15
17
  import * as i2 from 'ngx-tethys/grid';
16
18
  import { ThyGridModule } from 'ngx-tethys/grid';
17
- import { ThyTooltipDirective } from 'ngx-tethys/tooltip';
18
19
  import { injectLocale } from 'ngx-tethys/i18n';
19
- import { outputToObservable } from '@angular/core/rxjs-interop';
20
+ import { ThyTooltipDirective } from 'ngx-tethys/tooltip';
20
21
 
21
22
  /**
22
23
  * @private
@@ -716,6 +717,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
716
717
  class ThySelectControl {
717
718
  constructor() {
718
719
  this.renderer = inject(Renderer2);
720
+ this.cdr = inject(ChangeDetectorRef);
721
+ this.ngZone = inject(NgZone);
722
+ this.destroyRef = inject(DestroyRef);
719
723
  this.inputValue = model('');
720
724
  this.isComposing = signal(false);
721
725
  this.isFirstPanelOpenedChange = true;
@@ -745,7 +749,13 @@ class ThySelectControl {
745
749
  return 'md';
746
750
  }
747
751
  });
748
- this.thyMaxTagCount = input(0, { transform: numberAttribute });
752
+ this.thyMaxTagCount = input(0, {
753
+ transform: (value) => {
754
+ if (value === 'auto')
755
+ return 'auto';
756
+ return numberAttribute(value, 0);
757
+ }
758
+ });
749
759
  this.thyBorderless = input(false, { transform: coerceBooleanProperty });
750
760
  this.thyPreset = input('');
751
761
  this.thyOnSearch = output();
@@ -758,23 +768,29 @@ class ThySelectControl {
758
768
  return ((!this.thyIsMultiple() && !isUndefinedOrNull(this.thySelectedOptions())) ||
759
769
  (this.thyIsMultiple() && this.thySelectedOptions().length > 0));
760
770
  });
771
+ this.tagsContainer = viewChild('tagsContainer');
772
+ this.visibleTagCount = signal(0);
761
773
  this.showClearIcon = computed(() => {
762
774
  return this.thyAllowClear() && this.isSelectedValue();
763
775
  });
764
- this.maxSelectedTags = computed(() => {
765
- const selectedOptions = this.thySelectedOptions();
766
- if (this.thyMaxTagCount() > 0 && selectedOptions instanceof Array && selectedOptions.length > this.thyMaxTagCount()) {
767
- return selectedOptions.slice(0, this.thyMaxTagCount() - 1);
768
- }
776
+ this.selectedTags = computed(() => {
777
+ if (!this.thyIsMultiple() || !this.thySelectedOptions())
778
+ return [];
779
+ const selectedOptions = coerceArray(this.thySelectedOptions());
769
780
  return selectedOptions;
770
781
  });
771
782
  this.collapsedSelectedTags = computed(() => {
772
- const selectedOptions = this.thySelectedOptions();
773
- const maxTagCount = this.thyMaxTagCount();
774
- if (maxTagCount && selectedOptions instanceof Array && selectedOptions.length > maxTagCount) {
775
- return selectedOptions.slice(maxTagCount - 1, selectedOptions.length);
783
+ if (!this.thyIsMultiple() || !this.thySelectedOptions())
784
+ return [];
785
+ const selectedOptions = coerceArray(this.thySelectedOptions());
786
+ const shouldShowMoreTags = this.thyMaxTagCount() === 'auto' || this.thyMaxTagCount() > 0;
787
+ if (!shouldShowMoreTags) {
788
+ return [];
789
+ }
790
+ if (this.visibleTagCount() <= 0) {
791
+ return selectedOptions;
776
792
  }
777
- return [];
793
+ return selectedOptions.slice(this.visibleTagCount());
778
794
  });
779
795
  this.selectedValueStyle = computed(() => {
780
796
  let showSelectedValue = false;
@@ -864,11 +880,82 @@ class ThySelectControl {
864
880
  }
865
881
  }, 200);
866
882
  }
883
+ if (!sameValue && this.thyIsMultiple()) {
884
+ this.calculateVisibleTags();
885
+ }
867
886
  });
868
887
  }
869
888
  });
870
889
  }
871
890
  ngOnInit() { }
891
+ ngAfterViewInit() {
892
+ setTimeout(() => {
893
+ this.calculateVisibleTags();
894
+ }, 0);
895
+ this.ngZone.runOutsideAngular(() => {
896
+ this.resizeObserver(this.inputElement()?.nativeElement)
897
+ .pipe(throttleTime(100), takeUntilDestroyed(this.destroyRef))
898
+ .subscribe(() => {
899
+ this.calculateVisibleTags();
900
+ });
901
+ });
902
+ }
903
+ resizeObserver(element) {
904
+ return typeof ResizeObserver === 'undefined' || !ResizeObserver
905
+ ? of(null)
906
+ : new Observable(observer => {
907
+ const resize = new ResizeObserver((entries) => {
908
+ observer.next(entries);
909
+ });
910
+ resize.observe(element);
911
+ return () => {
912
+ resize.disconnect();
913
+ };
914
+ });
915
+ }
916
+ calculateVisibleTags() {
917
+ if (!this.tagsContainer()?.nativeElement)
918
+ return;
919
+ const containerWidth = this.tagsContainer().nativeElement.offsetWidth;
920
+ if (containerWidth <= 0)
921
+ return;
922
+ const selectedOptions = coerceArray(this.thySelectedOptions());
923
+ if (!selectedOptions?.length) {
924
+ this.visibleTagCount.set(0);
925
+ return;
926
+ }
927
+ const shouldShowMoreTags = this.thyMaxTagCount() === 'auto' || this.thyMaxTagCount() > 0;
928
+ if (!shouldShowMoreTags) {
929
+ this.visibleTagCount.set(selectedOptions.length);
930
+ this.cdr.markForCheck();
931
+ return;
932
+ }
933
+ if (this.thyMaxTagCount() > 0) {
934
+ this.visibleTagCount.set(this.thyMaxTagCount() - 1);
935
+ this.cdr.markForCheck();
936
+ return;
937
+ }
938
+ const COLLAPSED_TAG_WIDTH = 46;
939
+ const TAG_GAP = 4;
940
+ const availableWidth = containerWidth - COLLAPSED_TAG_WIDTH - 3;
941
+ let totalWidth = 0;
942
+ let visibleCount = 0;
943
+ Promise.resolve().then(() => {
944
+ const tagElements = this.tagsContainer().nativeElement.querySelectorAll('.choice-item.selected,.custom-choice-item');
945
+ for (let i = 0; i < selectedOptions.length; i++) {
946
+ let tagWidth;
947
+ tagWidth = (tagElements[i]?.offsetWidth || 80) + TAG_GAP;
948
+ if (totalWidth + tagWidth > availableWidth) {
949
+ break;
950
+ }
951
+ totalWidth += tagWidth;
952
+ visibleCount++;
953
+ }
954
+ // 至少展示一个标签
955
+ this.visibleTagCount.set(Math.max(1, visibleCount));
956
+ this.cdr.markForCheck();
957
+ });
958
+ }
872
959
  setSelectControlClass() {
873
960
  const modeType = this.thyIsMultiple() ? 'multiple' : 'single';
874
961
  const selectControlClass = {
@@ -934,13 +1021,13 @@ class ThySelectControl {
934
1021
  this.thyOnBlur.emit(event);
935
1022
  }
936
1023
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectControl, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
937
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySelectControl, isStandalone: true, selector: "thy-select-control,[thySelectControl]", inputs: { inputValue: { classPropertyName: "inputValue", publicName: "inputValue", isSignal: true, isRequired: false, transformFunction: null }, thyPanelOpened: { classPropertyName: "thyPanelOpened", publicName: "thyPanelOpened", isSignal: true, isRequired: false, transformFunction: null }, thyIsMultiple: { classPropertyName: "thyIsMultiple", publicName: "thyIsMultiple", isSignal: true, isRequired: false, transformFunction: null }, thyShowSearch: { classPropertyName: "thyShowSearch", publicName: "thyShowSearch", isSignal: true, isRequired: false, transformFunction: null }, thySelectedOptions: { classPropertyName: "thySelectedOptions", publicName: "thySelectedOptions", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null }, customDisplayTemplate: { classPropertyName: "customDisplayTemplate", publicName: "customDisplayTemplate", isSignal: true, isRequired: false, transformFunction: null }, thyAllowClear: { classPropertyName: "thyAllowClear", publicName: "thyAllowClear", isSignal: true, isRequired: false, transformFunction: null }, thyPlaceholder: { classPropertyName: "thyPlaceholder", publicName: "thyPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyMaxTagCount: { classPropertyName: "thyMaxTagCount", publicName: "thyMaxTagCount", isSignal: true, isRequired: false, transformFunction: null }, thyBorderless: { classPropertyName: "thyBorderless", publicName: "thyBorderless", isSignal: true, isRequired: false, transformFunction: null }, thyPreset: { classPropertyName: "thyPreset", publicName: "thyPreset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inputValue: "inputValueChange", thyOnSearch: "thyOnSearch", thyOnRemove: "thyOnRemove", thyOnClear: "thyOnClear", thyOnBlur: "thyOnBlur" }, host: { properties: { "class.select-control-borderless": "thyBorderless()" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"compositionChange(true)\"\n (compositionend)=\"compositionChange(false)\"\n autocomplete=\"something-new\"\n [ngClass]=\"searchInputControlClass\"\n (input)=\"updateWidth()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"setInputValue($event)\"\n (keydown.backspace)=\"handleBackspace($event)\"\n [disabled]=\"thyDisabled()\"\n (blur)=\"onBlur($event)\" />\n</ng-template>\n\n<div class=\"select-control-rendered\">\n @if (!isSelectedValue()) {\n <div class=\"text-placeholder text-truncate\" [ngStyle]=\"placeholderStyle()\">\n {{ thyPlaceholder() }}\n </div>\n }\n @if (thyIsMultiple()) {\n <div thyFlex thyWrap=\"wrap\" thyGap=\"4\" thyAlignItems=\"center\" class=\"w-100\">\n @if (thyPreset() === 'tag') {\n @for (item of maxSelectedTags(); track trackValue($index, item)) {\n <div thyFlexItem class=\"custom-choice-item text-truncate\">\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\">\n </ng-template>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n } @else {\n @for (item of maxSelectedTags(); track trackValue($index, item)) {\n <div thyFlexItem thyTag class=\"choice-item\" [ngClass]=\"{ disabled: thyDisabled() === true }\" [thySize]=\"tagSize()\">\n <div class=\"text-truncate h-100\">\n @if (!customDisplayTemplate()) {\n {{ item?.thyLabelText }}\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\"></ng-template>\n }\n </div>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n }\n @if (thyMaxTagCount() && thySelectedOptions()?.length > thyMaxTagCount()) {\n <div\n thyFlexItem\n class=\"choice-item max-tag-count-choice\"\n thyTag\n [thySize]=\"tagSize()\"\n [ngClass]=\"{ disabled: thyDisabled() === true }\"\n [thyTooltip]=\"maxTagTooltip\">\n <div class=\"text-truncate\">+{{ thySelectedOptions()?.length - thyMaxTagCount() + 1 }}</div>\n </div>\n }\n <div thyFlexItem class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n </div>\n } @else {\n @if (isSelectedValue()) {\n <div class=\"selected-value text-truncate\" [ngStyle]=\"selectedValueStyle()\">\n @if (!customDisplayTemplate()) {\n <span class=\"text-truncate\">{{ thySelectedOptions()?.thyLabelText }}</span>\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: thySelectedOptions()?.thyRawValue || thySelectedOptions()?.thyValue || thySelectedOptions()\n }\"></ng-template>\n }\n </div>\n }\n <div class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n }\n</div>\n<span class=\"select-control-arrow\">\n <thy-icon thyIconName=\"angle-down\" class=\"font-size-base\"></thy-icon>\n</span>\n@if (showClearIcon()) {\n <span class=\"select-control-clear remove-link\" (click)=\"clearHandle($event)\">\n <thy-icon class=\"remove-link-icon font-size-base\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </span>\n}\n\n<ng-template #maxTagTooltip>\n @let lastIndex = collapsedSelectedTags().length - 1;\n @for (item of collapsedSelectedTags(); track trackValue($index, item)) {\n {{ item.thyLabelText }}\n @if ($index !== lastIndex) {\n {{ locale().comma }}\n }\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ThyTag, selector: "thy-tag,[thyTag]", inputs: ["thyTag", "thyShape", "thyColor", "thyTheme", "thySize", "thyHoverable"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "ngmodule", type: ThyGridModule }, { kind: "directive", type: i2.ThyFlex, selector: "[thyFlex]", inputs: ["thyDirection", "thyWrap", "thyJustifyContent", "thyAlignItems", "thyGap"] }, { kind: "directive", type: i2.ThyFlexItem, selector: "[thyFlexItem]", inputs: ["thyFlexItem", "thyGrow", "thyShrink", "thyBasis"] }, { kind: "directive", type: ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1024
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySelectControl, isStandalone: true, selector: "thy-select-control,[thySelectControl]", inputs: { inputValue: { classPropertyName: "inputValue", publicName: "inputValue", isSignal: true, isRequired: false, transformFunction: null }, thyPanelOpened: { classPropertyName: "thyPanelOpened", publicName: "thyPanelOpened", isSignal: true, isRequired: false, transformFunction: null }, thyIsMultiple: { classPropertyName: "thyIsMultiple", publicName: "thyIsMultiple", isSignal: true, isRequired: false, transformFunction: null }, thyShowSearch: { classPropertyName: "thyShowSearch", publicName: "thyShowSearch", isSignal: true, isRequired: false, transformFunction: null }, thySelectedOptions: { classPropertyName: "thySelectedOptions", publicName: "thySelectedOptions", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null }, customDisplayTemplate: { classPropertyName: "customDisplayTemplate", publicName: "customDisplayTemplate", isSignal: true, isRequired: false, transformFunction: null }, thyAllowClear: { classPropertyName: "thyAllowClear", publicName: "thyAllowClear", isSignal: true, isRequired: false, transformFunction: null }, thyPlaceholder: { classPropertyName: "thyPlaceholder", publicName: "thyPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyMaxTagCount: { classPropertyName: "thyMaxTagCount", publicName: "thyMaxTagCount", isSignal: true, isRequired: false, transformFunction: null }, thyBorderless: { classPropertyName: "thyBorderless", publicName: "thyBorderless", isSignal: true, isRequired: false, transformFunction: null }, thyPreset: { classPropertyName: "thyPreset", publicName: "thyPreset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inputValue: "inputValueChange", thyOnSearch: "thyOnSearch", thyOnRemove: "thyOnRemove", thyOnClear: "thyOnClear", thyOnBlur: "thyOnBlur" }, host: { properties: { "class.select-control-borderless": "thyBorderless()" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, isSignal: true }, { propertyName: "tagsContainer", first: true, predicate: ["tagsContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"compositionChange(true)\"\n (compositionend)=\"compositionChange(false)\"\n autocomplete=\"something-new\"\n [ngClass]=\"searchInputControlClass\"\n (input)=\"updateWidth()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"setInputValue($event)\"\n (keydown.backspace)=\"handleBackspace($event)\"\n [disabled]=\"thyDisabled()\"\n (blur)=\"onBlur($event)\" />\n</ng-template>\n\n<div class=\"select-control-rendered\">\n @if (!isSelectedValue()) {\n <div class=\"text-placeholder text-truncate\" [ngStyle]=\"placeholderStyle()\">\n {{ thyPlaceholder() }}\n </div>\n }\n @if (thyIsMultiple()) {\n <div thyFlex thyWrap=\"wrap\" thyGap=\"4\" thyAlignItems=\"center\" class=\"w-100\" #tagsContainer>\n @if (thyPreset() === 'tag') {\n @for (item of selectedTags(); track trackValue($index, item)) {\n <div thyFlexItem class=\"custom-choice-item text-truncate\" [ngClass]=\"{ hidden: $index > visibleTagCount() - 1 }\">\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\">\n </ng-template>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n } @else {\n @for (item of selectedTags(); track trackValue($index, item)) {\n <div\n thyFlexItem\n thyTag\n class=\"choice-item selected\"\n [ngClass]=\"{ disabled: thyDisabled() === true, hidden: $index > visibleTagCount() - 1 }\"\n [thySize]=\"tagSize()\">\n <div class=\"text-truncate h-100 d-flex\">\n @if (!customDisplayTemplate()) {\n <thy-flexible-text [thyTooltipContent]=\"item?.thyLabelText\" class=\"text-truncate h-100\">\n {{ item?.thyLabelText }}\n </thy-flexible-text>\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\"></ng-template>\n }\n </div>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n }\n @if (collapsedSelectedTags()?.length > 0) {\n <div\n thyFlexItem\n class=\"choice-item max-tag-count-choice\"\n thyTag\n [thySize]=\"tagSize()\"\n [ngClass]=\"{ disabled: thyDisabled() === true }\"\n [thyTooltip]=\"maxTagTooltip\">\n <div class=\"text-truncate\">+{{ collapsedSelectedTags()?.length }}</div>\n </div>\n }\n <div thyFlexItem class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n </div>\n } @else {\n @if (isSelectedValue()) {\n <div class=\"selected-value text-truncate\" [ngStyle]=\"selectedValueStyle()\">\n @if (!customDisplayTemplate()) {\n <span class=\"text-truncate\">{{ thySelectedOptions()?.thyLabelText }}</span>\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: thySelectedOptions()?.thyRawValue || thySelectedOptions()?.thyValue || thySelectedOptions()\n }\"></ng-template>\n }\n </div>\n }\n <div class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n }\n</div>\n<span class=\"select-control-arrow\">\n <thy-icon thyIconName=\"angle-down\" class=\"font-size-base\"></thy-icon>\n</span>\n@if (showClearIcon()) {\n <span class=\"select-control-clear remove-link\" (click)=\"clearHandle($event)\">\n <thy-icon class=\"remove-link-icon font-size-base\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </span>\n}\n\n<ng-template #maxTagTooltip>\n @let lastIndex = collapsedSelectedTags().length - 1;\n @for (item of collapsedSelectedTags(); track trackValue($index, item)) {\n {{ item.thyLabelText }}\n @if ($index !== lastIndex) {\n {{ locale().comma }}\n }\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ThyTag, selector: "thy-tag,[thyTag]", inputs: ["thyTag", "thyShape", "thyColor", "thyTheme", "thySize", "thyHoverable"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "ngmodule", type: ThyGridModule }, { kind: "directive", type: i2.ThyFlex, selector: "[thyFlex]", inputs: ["thyDirection", "thyWrap", "thyJustifyContent", "thyAlignItems", "thyGap"] }, { kind: "directive", type: i2.ThyFlexItem, selector: "[thyFlexItem]", inputs: ["thyFlexItem", "thyGrow", "thyShrink", "thyBasis"] }, { kind: "directive", type: ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: ThyFlexibleText, selector: "thy-flexible-text,[thyFlexibleText]", inputs: ["thyTooltipTrigger", "thyContainerClass", "thyTooltipContent", "thyTooltipPlacement", "thyTooltipOffset"], exportAs: ["thyFlexibleText"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
938
1025
  }
939
1026
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectControl, decorators: [{
940
1027
  type: Component,
941
- args: [{ selector: 'thy-select-control,[thySelectControl]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, NgClass, NgStyle, ThyTag, NgTemplateOutlet, ThyIcon, ThyGridModule, ThyTooltipDirective], host: {
1028
+ args: [{ selector: 'thy-select-control,[thySelectControl]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, NgClass, NgStyle, ThyTag, NgTemplateOutlet, ThyIcon, ThyGridModule, ThyTooltipDirective, ThyFlexibleText], host: {
942
1029
  '[class.select-control-borderless]': 'thyBorderless()'
943
- }, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"compositionChange(true)\"\n (compositionend)=\"compositionChange(false)\"\n autocomplete=\"something-new\"\n [ngClass]=\"searchInputControlClass\"\n (input)=\"updateWidth()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"setInputValue($event)\"\n (keydown.backspace)=\"handleBackspace($event)\"\n [disabled]=\"thyDisabled()\"\n (blur)=\"onBlur($event)\" />\n</ng-template>\n\n<div class=\"select-control-rendered\">\n @if (!isSelectedValue()) {\n <div class=\"text-placeholder text-truncate\" [ngStyle]=\"placeholderStyle()\">\n {{ thyPlaceholder() }}\n </div>\n }\n @if (thyIsMultiple()) {\n <div thyFlex thyWrap=\"wrap\" thyGap=\"4\" thyAlignItems=\"center\" class=\"w-100\">\n @if (thyPreset() === 'tag') {\n @for (item of maxSelectedTags(); track trackValue($index, item)) {\n <div thyFlexItem class=\"custom-choice-item text-truncate\">\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\">\n </ng-template>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n } @else {\n @for (item of maxSelectedTags(); track trackValue($index, item)) {\n <div thyFlexItem thyTag class=\"choice-item\" [ngClass]=\"{ disabled: thyDisabled() === true }\" [thySize]=\"tagSize()\">\n <div class=\"text-truncate h-100\">\n @if (!customDisplayTemplate()) {\n {{ item?.thyLabelText }}\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\"></ng-template>\n }\n </div>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n }\n @if (thyMaxTagCount() && thySelectedOptions()?.length > thyMaxTagCount()) {\n <div\n thyFlexItem\n class=\"choice-item max-tag-count-choice\"\n thyTag\n [thySize]=\"tagSize()\"\n [ngClass]=\"{ disabled: thyDisabled() === true }\"\n [thyTooltip]=\"maxTagTooltip\">\n <div class=\"text-truncate\">+{{ thySelectedOptions()?.length - thyMaxTagCount() + 1 }}</div>\n </div>\n }\n <div thyFlexItem class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n </div>\n } @else {\n @if (isSelectedValue()) {\n <div class=\"selected-value text-truncate\" [ngStyle]=\"selectedValueStyle()\">\n @if (!customDisplayTemplate()) {\n <span class=\"text-truncate\">{{ thySelectedOptions()?.thyLabelText }}</span>\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: thySelectedOptions()?.thyRawValue || thySelectedOptions()?.thyValue || thySelectedOptions()\n }\"></ng-template>\n }\n </div>\n }\n <div class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n }\n</div>\n<span class=\"select-control-arrow\">\n <thy-icon thyIconName=\"angle-down\" class=\"font-size-base\"></thy-icon>\n</span>\n@if (showClearIcon()) {\n <span class=\"select-control-clear remove-link\" (click)=\"clearHandle($event)\">\n <thy-icon class=\"remove-link-icon font-size-base\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </span>\n}\n\n<ng-template #maxTagTooltip>\n @let lastIndex = collapsedSelectedTags().length - 1;\n @for (item of collapsedSelectedTags(); track trackValue($index, item)) {\n {{ item.thyLabelText }}\n @if ($index !== lastIndex) {\n {{ locale().comma }}\n }\n }\n</ng-template>\n" }]
1030
+ }, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"compositionChange(true)\"\n (compositionend)=\"compositionChange(false)\"\n autocomplete=\"something-new\"\n [ngClass]=\"searchInputControlClass\"\n (input)=\"updateWidth()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"setInputValue($event)\"\n (keydown.backspace)=\"handleBackspace($event)\"\n [disabled]=\"thyDisabled()\"\n (blur)=\"onBlur($event)\" />\n</ng-template>\n\n<div class=\"select-control-rendered\">\n @if (!isSelectedValue()) {\n <div class=\"text-placeholder text-truncate\" [ngStyle]=\"placeholderStyle()\">\n {{ thyPlaceholder() }}\n </div>\n }\n @if (thyIsMultiple()) {\n <div thyFlex thyWrap=\"wrap\" thyGap=\"4\" thyAlignItems=\"center\" class=\"w-100\" #tagsContainer>\n @if (thyPreset() === 'tag') {\n @for (item of selectedTags(); track trackValue($index, item)) {\n <div thyFlexItem class=\"custom-choice-item text-truncate\" [ngClass]=\"{ hidden: $index > visibleTagCount() - 1 }\">\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\">\n </ng-template>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n } @else {\n @for (item of selectedTags(); track trackValue($index, item)) {\n <div\n thyFlexItem\n thyTag\n class=\"choice-item selected\"\n [ngClass]=\"{ disabled: thyDisabled() === true, hidden: $index > visibleTagCount() - 1 }\"\n [thySize]=\"tagSize()\">\n <div class=\"text-truncate h-100 d-flex\">\n @if (!customDisplayTemplate()) {\n <thy-flexible-text [thyTooltipContent]=\"item?.thyLabelText\" class=\"text-truncate h-100\">\n {{ item?.thyLabelText }}\n </thy-flexible-text>\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\"></ng-template>\n }\n </div>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n }\n @if (collapsedSelectedTags()?.length > 0) {\n <div\n thyFlexItem\n class=\"choice-item max-tag-count-choice\"\n thyTag\n [thySize]=\"tagSize()\"\n [ngClass]=\"{ disabled: thyDisabled() === true }\"\n [thyTooltip]=\"maxTagTooltip\">\n <div class=\"text-truncate\">+{{ collapsedSelectedTags()?.length }}</div>\n </div>\n }\n <div thyFlexItem class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n </div>\n } @else {\n @if (isSelectedValue()) {\n <div class=\"selected-value text-truncate\" [ngStyle]=\"selectedValueStyle()\">\n @if (!customDisplayTemplate()) {\n <span class=\"text-truncate\">{{ thySelectedOptions()?.thyLabelText }}</span>\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: thySelectedOptions()?.thyRawValue || thySelectedOptions()?.thyValue || thySelectedOptions()\n }\"></ng-template>\n }\n </div>\n }\n <div class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n }\n</div>\n<span class=\"select-control-arrow\">\n <thy-icon thyIconName=\"angle-down\" class=\"font-size-base\"></thy-icon>\n</span>\n@if (showClearIcon()) {\n <span class=\"select-control-clear remove-link\" (click)=\"clearHandle($event)\">\n <thy-icon class=\"remove-link-icon font-size-base\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </span>\n}\n\n<ng-template #maxTagTooltip>\n @let lastIndex = collapsedSelectedTags().length - 1;\n @for (item of collapsedSelectedTags(); track trackValue($index, item)) {\n {{ item.thyLabelText }}\n @if ($index !== lastIndex) {\n {{ locale().comma }}\n }\n }\n</ng-template>\n" }]
944
1031
  }], ctorParameters: () => [] });
945
1032
 
946
1033
  /**