ngx-tethys 20.0.1 → 20.0.2
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/CHANGELOG.md +17 -0
- package/action/index.d.ts +3 -3
- package/affix/index.d.ts +1 -1
- package/alert/index.d.ts +3 -3
- package/anchor/index.d.ts +3 -3
- package/arrow-switcher/index.d.ts +6 -6
- package/autocomplete/index.d.ts +7 -7
- package/avatar/index.d.ts +9 -9
- package/back-top/index.d.ts +3 -3
- package/badge/index.d.ts +6 -6
- package/breadcrumb/index.d.ts +7 -7
- package/button/index.d.ts +19 -19
- package/calendar/index.d.ts +8 -8
- package/card/index.d.ts +6 -6
- package/carousel/index.d.ts +4 -4
- package/cascader/index.d.ts +24 -24
- package/collapse/index.d.ts +4 -4
- package/color-picker/index.d.ts +16 -16
- package/comment/index.d.ts +3 -3
- package/copy/index.d.ts +2 -2
- package/core/index.d.ts +22 -22
- package/date-picker/index.d.ts +111 -111
- package/date-range/index.d.ts +5 -5
- package/dialog/index.d.ts +18 -18
- package/divider/index.d.ts +3 -3
- package/drag-drop/index.d.ts +7 -7
- package/dropdown/index.d.ts +10 -10
- package/empty/index.d.ts +12 -12
- package/fesm2022/ngx-tethys-action.mjs +14 -12
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +7 -7
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-alert.mjs +10 -10
- package/fesm2022/ngx-tethys-anchor.mjs +11 -11
- package/fesm2022/ngx-tethys-anchor.mjs.map +1 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +7 -7
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +19 -18
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-avatar.mjs +23 -22
- package/fesm2022/ngx-tethys-avatar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-back-top.mjs +7 -7
- package/fesm2022/ngx-tethys-badge.mjs +7 -7
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-breadcrumb.mjs +10 -10
- package/fesm2022/ngx-tethys-breadcrumb.mjs.map +1 -1
- package/fesm2022/ngx-tethys-button.mjs +16 -16
- package/fesm2022/ngx-tethys-button.mjs.map +1 -1
- package/fesm2022/ngx-tethys-calendar.mjs +16 -16
- package/fesm2022/ngx-tethys-calendar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-card.mjs +13 -13
- package/fesm2022/ngx-tethys-card.mjs.map +1 -1
- package/fesm2022/ngx-tethys-carousel.mjs +15 -15
- package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +41 -34
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +7 -7
- package/fesm2022/ngx-tethys-collapse.mjs +10 -10
- package/fesm2022/ngx-tethys-color-picker.mjs +65 -57
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-comment.mjs +13 -13
- package/fesm2022/ngx-tethys-copy.mjs +10 -10
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-core.mjs +30 -25
- package/fesm2022/ngx-tethys-core.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-picker.mjs +184 -174
- package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-range.mjs +16 -16
- package/fesm2022/ngx-tethys-date-range.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dialog.mjs +24 -24
- package/fesm2022/ngx-tethys-dialog.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +7 -7
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dot.mjs +7 -7
- package/fesm2022/ngx-tethys-drag-drop.mjs +24 -24
- package/fesm2022/ngx-tethys-drag-drop.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +48 -47
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +13 -13
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +7 -7
- package/fesm2022/ngx-tethys-flexible-text.mjs.map +1 -1
- package/fesm2022/ngx-tethys-form.mjs +64 -61
- package/fesm2022/ngx-tethys-form.mjs.map +1 -1
- package/fesm2022/ngx-tethys-fullscreen.mjs +18 -15
- package/fesm2022/ngx-tethys-fullscreen.mjs.map +1 -1
- package/fesm2022/ngx-tethys-grid.mjs +34 -33
- package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
- package/fesm2022/ngx-tethys-guider.mjs +25 -24
- package/fesm2022/ngx-tethys-guider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +3 -3
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-icon.mjs +15 -13
- package/fesm2022/ngx-tethys-icon.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +31 -29
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs +17 -10
- package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input.mjs +28 -27
- package/fesm2022/ngx-tethys-input.mjs.map +1 -1
- package/fesm2022/ngx-tethys-layout.mjs +63 -63
- package/fesm2022/ngx-tethys-layout.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +21 -18
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-loading.mjs +7 -7
- package/fesm2022/ngx-tethys-mention.mjs +35 -31
- package/fesm2022/ngx-tethys-mention.mjs.map +1 -1
- package/fesm2022/ngx-tethys-menu.mjs +26 -26
- package/fesm2022/ngx-tethys-menu.mjs.map +1 -1
- package/fesm2022/ngx-tethys-message.mjs +24 -24
- package/fesm2022/ngx-tethys-message.mjs.map +1 -1
- package/fesm2022/ngx-tethys-nav.mjs +27 -27
- package/fesm2022/ngx-tethys-nav.mjs.map +1 -1
- package/fesm2022/ngx-tethys-notify.mjs +20 -20
- package/fesm2022/ngx-tethys-notify.mjs.map +1 -1
- package/fesm2022/ngx-tethys-pagination.mjs +18 -18
- package/fesm2022/ngx-tethys-pagination.mjs.map +1 -1
- package/fesm2022/ngx-tethys-popover.mjs +22 -21
- package/fesm2022/ngx-tethys-popover.mjs.map +1 -1
- package/fesm2022/ngx-tethys-progress.mjs +17 -17
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property-operation.mjs +11 -11
- package/fesm2022/ngx-tethys-property-operation.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +12 -11
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +17 -17
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-rate.mjs +12 -12
- package/fesm2022/ngx-tethys-rate.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +21 -18
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-result.mjs +11 -11
- package/fesm2022/ngx-tethys-result.mjs.map +1 -1
- package/fesm2022/ngx-tethys-segment.mjs +19 -16
- package/fesm2022/ngx-tethys-segment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-select.mjs +60 -38
- package/fesm2022/ngx-tethys-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-shared.mjs +82 -79
- package/fesm2022/ngx-tethys-shared.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +32 -32
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slide.mjs +37 -36
- package/fesm2022/ngx-tethys-slide.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slider.mjs +11 -11
- package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-space.mjs +10 -10
- package/fesm2022/ngx-tethys-statistic.mjs +7 -7
- package/fesm2022/ngx-tethys-statistic.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs +22 -22
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-strength.mjs +7 -7
- package/fesm2022/ngx-tethys-strength.mjs.map +1 -1
- package/fesm2022/ngx-tethys-switch.mjs +7 -7
- package/fesm2022/ngx-tethys-switch.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +28 -28
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tabs.mjs +13 -13
- package/fesm2022/ngx-tethys-tabs.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tag.mjs +11 -11
- package/fesm2022/ngx-tethys-tag.mjs.map +1 -1
- package/fesm2022/ngx-tethys-testing.mjs +1 -1
- package/fesm2022/ngx-tethys-testing.mjs.map +1 -1
- package/fesm2022/ngx-tethys-time-picker.mjs +22 -22
- package/fesm2022/ngx-tethys-time-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-timeline.mjs +14 -14
- package/fesm2022/ngx-tethys-timeline.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tooltip.mjs +19 -16
- package/fesm2022/ngx-tethys-tooltip.mjs.map +1 -1
- package/fesm2022/ngx-tethys-transfer.mjs +15 -15
- package/fesm2022/ngx-tethys-transfer.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +17 -17
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree.mjs +50 -43
- package/fesm2022/ngx-tethys-tree.mjs.map +1 -1
- package/fesm2022/ngx-tethys-typography.mjs +16 -16
- package/fesm2022/ngx-tethys-typography.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +26 -25
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-util.mjs +11 -5
- package/fesm2022/ngx-tethys-util.mjs.map +1 -1
- package/fesm2022/ngx-tethys-vote.mjs +7 -7
- package/fesm2022/ngx-tethys-watermark.mjs +18 -15
- package/fesm2022/ngx-tethys-watermark.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/flexible-text/index.d.ts +5 -5
- package/form/index.d.ts +26 -22
- package/fullscreen/index.d.ts +4 -4
- package/grid/index.d.ts +12 -12
- package/guider/index.d.ts +10 -10
- package/i18n/index.d.ts +1 -1
- package/icon/index.d.ts +3 -3
- package/image/index.d.ts +12 -12
- package/input/index.d.ts +22 -22
- package/input-number/index.d.ts +4 -4
- package/layout/index.d.ts +16 -16
- package/list/index.d.ts +16 -15
- package/mention/index.d.ts +4 -4
- package/menu/index.d.ts +7 -7
- package/message/index.d.ts +5 -5
- package/nav/index.d.ts +12 -12
- package/notify/index.d.ts +1 -1
- package/package.json +1 -1
- package/pagination/index.d.ts +21 -17
- package/popover/index.d.ts +8 -8
- package/progress/index.d.ts +18 -18
- package/property/index.d.ts +6 -6
- package/property-operation/index.d.ts +3 -3
- package/radio/index.d.ts +6 -6
- package/rate/index.d.ts +5 -5
- package/resizable/index.d.ts +2 -2
- package/result/index.d.ts +8 -8
- package/schematics/testing/test-workspace.js +1 -0
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/segment/index.d.ts +9 -9
- package/select/index.d.ts +21 -21
- package/shared/index.d.ts +29 -29
- package/skeleton/index.d.ts +52 -52
- package/slide/index.d.ts +5 -5
- package/slider/index.d.ts +6 -6
- package/space/index.d.ts +1 -1
- package/statistic/index.d.ts +18 -18
- package/stepper/index.d.ts +8 -8
- package/switch/index.d.ts +2 -2
- package/table/index.d.ts +24 -24
- package/tabs/index.d.ts +6 -6
- package/testing/index.d.ts +1 -1
- package/time-picker/index.d.ts +21 -21
- package/timeline/index.d.ts +8 -8
- package/tooltip/index.d.ts +12 -12
- package/transfer/index.d.ts +16 -16
- package/tree/index.d.ts +28 -28
- package/tree-select/index.d.ts +13 -13
- package/typography/index.d.ts +3 -3
- package/upload/index.d.ts +4 -4
- package/util/index.d.ts +17 -7
- package/vote/index.d.ts +2 -2
- package/watermark/index.d.ts +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Overlay, CdkConnectedOverlay, CdkOverlayOrigin, OverlayModule } from '@angular/cdk/overlay';
|
|
2
2
|
import { isPlatformBrowser, NgClass, NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, inject, NgZone, ElementRef, ChangeDetectorRef, PLATFORM_ID, computed, input, signal, DestroyRef, viewChild, output, contentChild,
|
|
4
|
+
import { InjectionToken, inject, NgZone, ElementRef, ChangeDetectorRef, PLATFORM_ID, computed, input, numberAttribute, signal, DestroyRef, viewChild, output, contentChild, contentChildren, linkedSignal, afterRenderEffect, untracked, forwardRef, HostListener, ViewChildren, ViewChild, Input, ChangeDetectionStrategy, Component, model, NgModule } from '@angular/core';
|
|
5
5
|
import * as i1$1 from '@angular/forms';
|
|
6
6
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
7
7
|
import { ThyEmpty, ThyEmptyModule } from 'ngx-tethys/empty';
|
|
@@ -16,8 +16,9 @@ import { map, filter, startWith, take, distinctUntilChanged } from 'rxjs/operato
|
|
|
16
16
|
import { coerceElement } from '@angular/cdk/coercion';
|
|
17
17
|
import { injectLocale } from 'ngx-tethys/i18n';
|
|
18
18
|
import * as i1 from '@angular/cdk/scrolling';
|
|
19
|
-
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
|
19
|
+
import { CdkVirtualScrollViewport, ScrollingModule, ScrollDispatcher } from '@angular/cdk/scrolling';
|
|
20
20
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
21
|
+
import { isUndefinedOrNull } from '@tethys/cdk/is';
|
|
21
22
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
22
23
|
|
|
23
24
|
const THY_SELECT_SCROLL_STRATEGY = new InjectionToken('thy-select-scroll-strategy');
|
|
@@ -70,7 +71,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
70
71
|
this.handleKeydown(event);
|
|
71
72
|
}
|
|
72
73
|
get optionsChanges$() {
|
|
73
|
-
let previousOptions = this.optionRenders
|
|
74
|
+
let previousOptions = this.optionRenders?.toArray();
|
|
74
75
|
return this.optionRenders.changes.pipe(map(data => {
|
|
75
76
|
return this.optionRenders.toArray();
|
|
76
77
|
}), filter(data => {
|
|
@@ -135,16 +136,18 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
135
136
|
this.dropDownPositions = computed(() => {
|
|
136
137
|
return getFlexiblePositions(this.placement(), this.defaultOffset);
|
|
137
138
|
}, ...(ngDevMode ? [{ debugName: "dropDownPositions" }] : []));
|
|
138
|
-
this.
|
|
139
|
+
this.thyItemSize = input(SELECT_OPTION_MAX_HEIGHT, ...(ngDevMode ? [{ debugName: "thyItemSize", transform: value => numberAttribute(value) }] : [{ transform: value => numberAttribute(value) }]));
|
|
139
140
|
this.virtualHeight = computed(() => {
|
|
140
141
|
const maxVirtualHeight = SELECT_PANEL_MAX_HEIGHT - SELECT_PANEL_PADDING_TOP - SELECT_PANEL_PADDING_BOTTOM;
|
|
141
|
-
const height = this.filteredGroupsAndOptions().length * this.
|
|
142
|
+
const height = this.filteredGroupsAndOptions().length * this.thyItemSize();
|
|
142
143
|
return Math.min(height, maxVirtualHeight);
|
|
143
144
|
}, ...(ngDevMode ? [{ debugName: "virtualHeight" }] : []));
|
|
144
145
|
/**
|
|
145
|
-
*
|
|
146
|
+
* 出现滚动条时,视觉上能看到的最大选项个数
|
|
146
147
|
*/
|
|
147
|
-
this.maxItemLength =
|
|
148
|
+
this.maxItemLength = computed(() => {
|
|
149
|
+
return Math.round(this.virtualHeight() / this.thyItemSize());
|
|
150
|
+
}, ...(ngDevMode ? [{ debugName: "maxItemLength" }] : []));
|
|
148
151
|
this.triggerRectWidth = signal(undefined, ...(ngDevMode ? [{ debugName: "triggerRectWidth" }] : []));
|
|
149
152
|
/**
|
|
150
153
|
* 手动聚焦中的标识
|
|
@@ -307,7 +310,12 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
307
310
|
return this.filteredGroupsAndOptions().filter(item => item.type === 'option');
|
|
308
311
|
}, ...(ngDevMode ? [{ debugName: "filteredOptions" }] : []));
|
|
309
312
|
this.filteredOptionsMap = computed(() => {
|
|
310
|
-
return
|
|
313
|
+
return this.filteredOptions().reduce((map, item) => {
|
|
314
|
+
if (!isUndefinedOrNull(item.value)) {
|
|
315
|
+
map.set(item.value, item);
|
|
316
|
+
}
|
|
317
|
+
return map;
|
|
318
|
+
}, new Map());
|
|
311
319
|
}, ...(ngDevMode ? [{ debugName: "filteredOptionsMap" }] : []));
|
|
312
320
|
/**
|
|
313
321
|
* 当前选中的值
|
|
@@ -415,7 +423,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
415
423
|
}
|
|
416
424
|
buildAllGroupsAndOptions() {
|
|
417
425
|
let allGroupsAndOptions;
|
|
418
|
-
const isReactiveDriven = this.thyOptions()
|
|
426
|
+
const isReactiveDriven = this.thyOptions() && this.thyOptions().length > 0;
|
|
419
427
|
if (isReactiveDriven) {
|
|
420
428
|
allGroupsAndOptions = this.allGroupsAndOptionsByReactive();
|
|
421
429
|
}
|
|
@@ -428,7 +436,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
428
436
|
const options = this.thyOptions();
|
|
429
437
|
const groupMap = new Map();
|
|
430
438
|
const ungroupedOptions = [];
|
|
431
|
-
|
|
439
|
+
const groupsAndOptions = [];
|
|
432
440
|
for (const option of options) {
|
|
433
441
|
if (option.groupLabel) {
|
|
434
442
|
if (!groupMap.has(option.groupLabel)) {
|
|
@@ -508,14 +516,14 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
508
516
|
const keywords = this.keywords();
|
|
509
517
|
const isServerSearch = this.thyServerSearch();
|
|
510
518
|
const allGroupsAndOptions = this.allGroupsAndOptions();
|
|
511
|
-
|
|
519
|
+
const filteredGroupsAndOptions = [];
|
|
512
520
|
if (keywords && !isServerSearch) {
|
|
513
521
|
const lowerKeywords = keywords.toLowerCase();
|
|
514
522
|
const matchedOptions = new Set();
|
|
515
523
|
const matchedGroupLabels = new Set();
|
|
516
524
|
for (const item of allGroupsAndOptions) {
|
|
517
525
|
if (item.type === 'option') {
|
|
518
|
-
const isMatch = (item.searchKey || item.label).toLowerCase().indexOf(lowerKeywords) > -1;
|
|
526
|
+
const isMatch = (item.searchKey || item.label) && (item.searchKey || item.label).toLowerCase().indexOf(lowerKeywords) > -1;
|
|
519
527
|
if (isMatch) {
|
|
520
528
|
matchedOptions.add(item.value);
|
|
521
529
|
if (item.groupLabel) {
|
|
@@ -539,7 +547,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
539
547
|
updateSelectedOptions() {
|
|
540
548
|
const selectedValues = this.selectedValues();
|
|
541
549
|
const isMultiple = untracked(() => this.isMultiple());
|
|
542
|
-
|
|
550
|
+
const newOptions = [];
|
|
543
551
|
if (selectedValues.length) {
|
|
544
552
|
const filteredOptionsMap = this.filteredOptionsMap();
|
|
545
553
|
const oldSelectedOptionsMap = untracked(() => {
|
|
@@ -557,7 +565,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
557
565
|
return helpers.keyBy(oldSelectedOptions, 'thyValue');
|
|
558
566
|
});
|
|
559
567
|
selectedValues.forEach(value => {
|
|
560
|
-
|
|
568
|
+
const option = filteredOptionsMap.get(value);
|
|
561
569
|
if (option) {
|
|
562
570
|
newOptions.push({
|
|
563
571
|
thyLabelText: option.label,
|
|
@@ -578,7 +586,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
578
586
|
optionsScrolled(index) {
|
|
579
587
|
this.scrolledIndex = index;
|
|
580
588
|
if (this.thyEnableScrollLoad()) {
|
|
581
|
-
const isScrollToBottom = index + this.maxItemLength >= this.filteredGroupsAndOptions().length;
|
|
589
|
+
const isScrollToBottom = index + this.maxItemLength() >= this.filteredGroupsAndOptions().length;
|
|
582
590
|
if (isScrollToBottom) {
|
|
583
591
|
this.thyOnScrollToBottom.emit();
|
|
584
592
|
}
|
|
@@ -704,9 +712,20 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
704
712
|
return;
|
|
705
713
|
}
|
|
706
714
|
let toActivatedValue = this.activatedValue();
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
715
|
+
const filteredOptionsMap = this.filteredOptionsMap();
|
|
716
|
+
if (!toActivatedValue || !filteredOptionsMap.has(toActivatedValue)) {
|
|
717
|
+
let selectedValues = this.selectedValues();
|
|
718
|
+
const lowerKeywords = this.keywords()?.trim()?.toLowerCase();
|
|
719
|
+
if (lowerKeywords) {
|
|
720
|
+
selectedValues = selectedValues.filter(value => {
|
|
721
|
+
const option = filteredOptionsMap.get(value);
|
|
722
|
+
return (option &&
|
|
723
|
+
(option.searchKey || option.label) &&
|
|
724
|
+
(option.searchKey || option.label).toLowerCase().indexOf(lowerKeywords) > -1);
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
if (selectedValues.length > 0) {
|
|
728
|
+
toActivatedValue = selectedValues[0];
|
|
710
729
|
}
|
|
711
730
|
else {
|
|
712
731
|
if (this.thyAutoActiveFirstItem()) {
|
|
@@ -722,7 +741,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
722
741
|
if (targetIndex === -1) {
|
|
723
742
|
return;
|
|
724
743
|
}
|
|
725
|
-
if (targetIndex < this.scrolledIndex || targetIndex >= this.scrolledIndex + this.maxItemLength) {
|
|
744
|
+
if (targetIndex < this.scrolledIndex || targetIndex >= this.scrolledIndex + this.maxItemLength()) {
|
|
726
745
|
this.cdkVirtualScrollViewport()?.scrollToIndex(targetIndex || 0);
|
|
727
746
|
}
|
|
728
747
|
if (needSelect) {
|
|
@@ -751,7 +770,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
751
770
|
if (keyCode === DOWN_ARROW || keyCode === UP_ARROW) {
|
|
752
771
|
event.preventDefault();
|
|
753
772
|
const activatedValue = this.activatedValue();
|
|
754
|
-
const currentOption = this.filteredOptionsMap()
|
|
773
|
+
const currentOption = this.filteredOptionsMap().get(activatedValue);
|
|
755
774
|
if (!currentOption) {
|
|
756
775
|
return;
|
|
757
776
|
}
|
|
@@ -834,11 +853,12 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
834
853
|
else {
|
|
835
854
|
selectedValues.push(value);
|
|
836
855
|
}
|
|
837
|
-
|
|
856
|
+
const thySortComparator = this.thySortComparator();
|
|
857
|
+
if (thySortComparator) {
|
|
838
858
|
selectedValues.sort((a, b) => {
|
|
839
859
|
const aOption = options.find(option => option.thyValue() === a);
|
|
840
860
|
const bOption = options.find(option => option.thyValue() === b);
|
|
841
|
-
return
|
|
861
|
+
return thySortComparator(aOption, bOption, [...options]);
|
|
842
862
|
});
|
|
843
863
|
}
|
|
844
864
|
this.selectedValues.set([...selectedValues]);
|
|
@@ -905,23 +925,25 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
905
925
|
ngOnDestroy() {
|
|
906
926
|
this.unsubscribeTriggerResize();
|
|
907
927
|
}
|
|
908
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
909
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.
|
|
928
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ThySelect, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
929
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: ThySelect, isStandalone: true, selector: "thy-select,thy-custom-select", inputs: { thyDropdownWidthMode: { classPropertyName: "thyDropdownWidthMode", publicName: "thyDropdownWidthMode", isSignal: true, isRequired: false, transformFunction: null }, thyItemSize: { classPropertyName: "thyItemSize", publicName: "thyItemSize", isSignal: true, isRequired: false, transformFunction: null }, thyShowSearch: { classPropertyName: "thyShowSearch", publicName: "thyShowSearch", isSignal: true, isRequired: false, transformFunction: null }, thyPlaceHolder: { classPropertyName: "thyPlaceHolder", publicName: "thyPlaceHolder", isSignal: true, isRequired: false, transformFunction: null }, thyServerSearch: { classPropertyName: "thyServerSearch", publicName: "thyServerSearch", isSignal: true, isRequired: false, transformFunction: null }, thyLoadState: { classPropertyName: "thyLoadState", publicName: "thyLoadState", isSignal: true, isRequired: false, transformFunction: null }, thyAutoActiveFirstItem: { classPropertyName: "thyAutoActiveFirstItem", publicName: "thyAutoActiveFirstItem", isSignal: true, isRequired: false, transformFunction: null }, thyMode: { classPropertyName: "thyMode", publicName: "thyMode", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyEmptyStateText: { classPropertyName: "thyEmptyStateText", publicName: "thyEmptyStateText", isSignal: true, isRequired: false, transformFunction: null }, thyEmptySearchMessageText: { classPropertyName: "thyEmptySearchMessageText", publicName: "thyEmptySearchMessageText", isSignal: true, isRequired: false, transformFunction: null }, thyEnableScrollLoad: { classPropertyName: "thyEnableScrollLoad", publicName: "thyEnableScrollLoad", isSignal: true, isRequired: false, transformFunction: null }, thyAllowClear: { classPropertyName: "thyAllowClear", publicName: "thyAllowClear", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: false, isRequired: false, transformFunction: coerceBooleanProperty }, thySortComparator: { classPropertyName: "thySortComparator", publicName: "thySortComparator", isSignal: true, isRequired: false, transformFunction: null }, thyFooterTemplate: { classPropertyName: "thyFooterTemplate", publicName: "thyFooterTemplate", isSignal: true, isRequired: false, transformFunction: null }, thyPlacement: { classPropertyName: "thyPlacement", publicName: "thyPlacement", isSignal: true, isRequired: false, transformFunction: null }, thyOrigin: { classPropertyName: "thyOrigin", publicName: "thyOrigin", isSignal: true, isRequired: false, transformFunction: null }, thyFooterClass: { classPropertyName: "thyFooterClass", publicName: "thyFooterClass", isSignal: true, isRequired: false, transformFunction: null }, thyAutoExpand: { classPropertyName: "thyAutoExpand", publicName: "thyAutoExpand", isSignal: true, isRequired: false, transformFunction: null }, thyHasBackdrop: { classPropertyName: "thyHasBackdrop", publicName: "thyHasBackdrop", 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 }, thyOptions: { classPropertyName: "thyOptions", publicName: "thyOptions", isSignal: true, isRequired: false, transformFunction: null }, thyPreset: { classPropertyName: "thyPreset", publicName: "thyPreset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyOnSearch: "thyOnSearch", thyOnScrollToBottom: "thyOnScrollToBottom", thyOnExpandStatusChange: "thyOnExpandStatusChange" }, host: { listeners: { "focus": "onFocus($event)", "blur": "onBlur($event)", "keydown": "keydown($event)" }, properties: { "class.thy-select-custom": "true", "class.thy-select": "true", "class.menu-is-opened": "panelOpen", "attr.tabindex": "tabIndex" } }, providers: [
|
|
910
930
|
{
|
|
911
931
|
provide: NG_VALUE_ACCESSOR,
|
|
912
932
|
useExisting: forwardRef(() => ThySelect),
|
|
913
933
|
multi: true
|
|
914
|
-
}
|
|
915
|
-
|
|
934
|
+
},
|
|
935
|
+
ScrollDispatcher
|
|
936
|
+
], queries: [{ propertyName: "selectedValueDisplayRef", first: true, predicate: ["selectedDisplay"], descendants: true, isSignal: true }, { propertyName: "options", predicate: ThyOption, descendants: true, isSignal: true }, { propertyName: "groups", predicate: ThySelectOptionGroup, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }, { propertyName: "cdkVirtualScrollViewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }, { propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, read: ElementRef, static: true }, { propertyName: "optionRenders", predicate: ThyOptionRender, descendants: true }], exportAs: ["thySelect"], usesInheritance: true, ngImport: i0, template: "<div\n cdk-overlay-origin\n thySelectControl\n (click)=\"toggle($event)\"\n #origin=\"cdkOverlayOrigin\"\n #trigger\n [thyPanelOpened]=\"panelOpen\"\n [thySelectedOptions]=\"selectedOptions()\"\n [thyIsMultiple]=\"isMultiple()\"\n [thyShowSearch]=\"thyShowSearch()\"\n [thyAllowClear]=\"thyAllowClear()\"\n [thySize]=\"thySize()\"\n [thyPlaceholder]=\"thyPlaceHolder()\"\n [customDisplayTemplate]=\"selectedValueDisplayRef()\"\n [thyDisabled]=\"disabled\"\n [thyBorderless]=\"thyBorderless()\"\n (thyOnClear)=\"clearSelectValue($event)\"\n (thyOnRemove)=\"remove($event)\"\n (thyOnSearch)=\"search($event)\"\n (thyOnBlur)=\"onBlur($event)\"\n [thyMaxTagCount]=\"thyMaxTagCount()\"\n [thyPreset]=\"thyPreset()\"></div>\n\n<ng-template\n cdk-connected-overlay\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n [cdkConnectedOverlayHasBackdrop]=\"thyHasBackdrop()\"\n [cdkConnectedOverlayPositions]=\"dropDownPositions()\"\n [cdkConnectedOverlayOrigin]=\"thyOrigin() || origin\"\n [cdkConnectedOverlayOpen]=\"panelOpen\"\n [cdkConnectedOverlayWidth]=\"triggerRectWidth()\"\n [cdkConnectedOverlayMinWidth]=\"dropDownMinWidth()\"\n [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy\"\n cdkConnectedOverlayTransformOriginOn=\".thy-select-dropdown\"\n (detach)=\"close()\">\n <div\n thyStopPropagation\n [attr.tabindex]=\"-1\"\n [ngClass]=\"dropDownClass()\"\n [@scaleYMotion]=\"placement() === 'top' || placement() === 'bottom' ? 'enter' : 'void'\"\n [@scaleXMotion]=\"placement() === 'left' || placement() === 'right' ? 'enter' : 'void'\"\n [@scaleMotion]=\"\n placement() !== 'top' && placement() !== 'bottom' && placement() !== 'left' && placement() !== 'right' ? 'enter' : 'void'\n \">\n @if (filteredGroupsAndOptions()?.length > 0) {\n <div\n #panel\n class=\"thy-select-dropdown-options thy-select-dropdown-options-{{ thySize() }} thy-select-dropdown-options-with-virtual-scroll\">\n <cdk-virtual-scroll-viewport\n class=\"thy-select-scroll-viewport\"\n [itemSize]=\"thyItemSize()\"\n [style.height.px]=\"virtualHeight()\"\n (scrolledIndexChange)=\"optionsScrolled($event)\"\n (mouseleave)=\"mouseLeaveOptions()\">\n <ng-template\n cdkVirtualFor\n [cdkVirtualForOf]=\"filteredGroupsAndOptions()\"\n [cdkVirtualForTrackBy]=\"trackByFn\"\n [cdkVirtualForTemplateCacheSize]=\"0\"\n let-item>\n @if (item.type === 'group') {\n <thy-option-group-render [thyGroupLabel]=\"item.label\"></thy-option-group-render>\n } @else {\n <thy-option-render\n [thyValue]=\"item.value\"\n [thyRawValue]=\"item.rawValue\"\n [thyLabelText]=\"item.label\"\n [thyShowOptionCustom]=\"item.showOptionCustom\"\n [thySearchKey]=\"item.searchKey\"\n [thyDisabled]=\"item.disabled\"\n [thyTemplate]=\"item.template\"\n [thyShowCheckedIcon]=\"isMultiple()\"\n [thySelectedValuesMap]=\"selectedValuesMap()\"\n [thyActivatedValue]=\"activatedValue()\"\n (optionHover)=\"optionHover($event)\"\n (optionClick)=\"optionClick($event)\">\n </thy-option-render>\n }\n </ng-template>\n </cdk-virtual-scroll-viewport>\n <ng-content></ng-content>\n </div>\n } @else {\n <thy-loading [thyDone]=\"thyLoadState()\" thySize=\"sm\"></thy-loading>\n <div class=\"thy-select-empty-content\">\n @if (thyLoadState()) {\n @let isSearching = keywords();\n <thy-empty\n [thyMessage]=\"isSearching ? thyEmptySearchMessageText() : thyEmptyStateText()\"\n thySize=\"sm\"\n [thyIconName]=\"emptyIcon()\"></thy-empty>\n }\n </div>\n }\n @if (thyFooterTemplate()) {\n <div [class]=\"thyFooterClass() ? thyFooterClass() : 'thy-custom-select-footer'\">\n @if (thyFooterTemplate()) {\n <ng-template [ngTemplateOutlet]=\"thyFooterTemplate()\"></ng-template>\n }\n </div>\n }\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: ThySelectControl, selector: "thy-select-control,[thySelectControl]", inputs: ["inputValue", "thyPanelOpened", "thyIsMultiple", "thyShowSearch", "thySelectedOptions", "thyDisabled", "customDisplayTemplate", "thyAllowClear", "thyPlaceholder", "thySize", "thyMaxTagCount", "thyBorderless", "thyPreset"], outputs: ["inputValueChange", "thyOnSearch", "thyOnRemove", "thyOnClear", "thyOnBlur"] }, { kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyLoading, selector: "thy-loading", inputs: ["thyDone", "thyTip", "thyIsMask"] }, { kind: "component", type: ThyEmpty, selector: "thy-empty", inputs: ["thyMessage", "thyTranslationKey", "thyTranslationValues", "thyEntityName", "thyEntityNameTranslateKey", "thyIconName", "thySize", "thyMarginTop", "thyTopAuto", "thyContainer", "thyImageUrl", "thyImageLoading", "thyImageFetchPriority", "thyDescription"] }, { kind: "component", type: ThyOptionRender, selector: "thy-option-render", inputs: ["thyValue", "thyRawValue", "thyLabelText", "thySearchKey", "thyDisabled", "thyShowOptionCustom", "thyTemplate", "thyTemplateContext", "thyShowCheckedIcon", "thySelectedValuesMap", "thyActivatedValue"], outputs: ["optionClick", "optionHover"] }, { kind: "component", type: ThyOptionGroupRender, selector: "thy-option-group-render", inputs: ["thyGroupLabel", "thyDisabled"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }], animations: [scaleXMotion, scaleYMotion, scaleMotion], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
916
937
|
}
|
|
917
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ThySelect, decorators: [{
|
|
918
939
|
type: Component,
|
|
919
940
|
args: [{ selector: 'thy-select,thy-custom-select', exportAs: 'thySelect', providers: [
|
|
920
941
|
{
|
|
921
942
|
provide: NG_VALUE_ACCESSOR,
|
|
922
943
|
useExisting: forwardRef(() => ThySelect),
|
|
923
944
|
multi: true
|
|
924
|
-
}
|
|
945
|
+
},
|
|
946
|
+
ScrollDispatcher
|
|
925
947
|
], changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
926
948
|
CdkOverlayOrigin,
|
|
927
949
|
ThySelectControl,
|
|
@@ -941,8 +963,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
941
963
|
'[attr.tabindex]': 'tabIndex',
|
|
942
964
|
'(focus)': 'onFocus($event)',
|
|
943
965
|
'(blur)': 'onBlur($event)'
|
|
944
|
-
}, animations: [scaleXMotion, scaleYMotion, scaleMotion], template: "<div\n cdk-overlay-origin\n thySelectControl\n (click)=\"toggle($event)\"\n #origin=\"cdkOverlayOrigin\"\n #trigger\n [thyPanelOpened]=\"panelOpen\"\n [thySelectedOptions]=\"selectedOptions()\"\n [thyIsMultiple]=\"isMultiple()\"\n [thyShowSearch]=\"thyShowSearch()\"\n [thyAllowClear]=\"thyAllowClear()\"\n [thySize]=\"thySize()\"\n [thyPlaceholder]=\"thyPlaceHolder()\"\n [customDisplayTemplate]=\"selectedValueDisplayRef()\"\n [thyDisabled]=\"disabled\"\n [thyBorderless]=\"thyBorderless()\"\n (thyOnClear)=\"clearSelectValue($event)\"\n (thyOnRemove)=\"remove($event)\"\n (thyOnSearch)=\"search($event)\"\n (thyOnBlur)=\"onBlur($event)\"\n [thyMaxTagCount]=\"thyMaxTagCount()\"\n [thyPreset]=\"thyPreset()\"></div>\n\n<ng-template\n cdk-connected-overlay\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n [cdkConnectedOverlayHasBackdrop]=\"thyHasBackdrop()\"\n [cdkConnectedOverlayPositions]=\"dropDownPositions()\"\n [cdkConnectedOverlayOrigin]=\"thyOrigin() || origin\"\n [cdkConnectedOverlayOpen]=\"panelOpen\"\n [cdkConnectedOverlayWidth]=\"triggerRectWidth()\"\n [cdkConnectedOverlayMinWidth]=\"dropDownMinWidth()\"\n [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy\"\n cdkConnectedOverlayTransformOriginOn=\".thy-select-dropdown\"\n (detach)=\"close()\">\n <div\n thyStopPropagation\n [attr.tabindex]=\"-1\"\n [ngClass]=\"dropDownClass()\"\n [@scaleYMotion]=\"placement() === 'top' || placement() === 'bottom' ? 'enter' : 'void'\"\n [@scaleXMotion]=\"placement() === 'left' || placement() === 'right' ? 'enter' : 'void'\"\n [@scaleMotion]=\"\n placement() !== 'top' && placement() !== 'bottom' && placement() !== 'left' && placement() !== 'right' ? 'enter' : 'void'\n \">\n @if (filteredGroupsAndOptions()?.length > 0) {\n <div\n #panel\n class=\"thy-select-dropdown-options thy-select-dropdown-options-{{ thySize() }} thy-select-dropdown-options-with-virtual-scroll\">\n <cdk-virtual-scroll-viewport\n class=\"thy-select-scroll-viewport\"\n [itemSize]=\"
|
|
945
|
-
}], ctorParameters: () => [], propDecorators: { thyDropdownWidthMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyDropdownWidthMode", required: false }] }], cdkConnectedOverlay: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkConnectedOverlay), { isSignal: true }] }], thyOnSearch: [{ type: i0.Output, args: ["thyOnSearch"] }], thyOnScrollToBottom: [{ type: i0.Output, args: ["thyOnScrollToBottom"] }], thyOnExpandStatusChange: [{ type: i0.Output, args: ["thyOnExpandStatusChange"] }], thyShowSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyShowSearch", required: false }] }], thyPlaceHolder: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyPlaceHolder", required: false }] }], thyServerSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyServerSearch", required: false }] }], thyLoadState: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyLoadState", required: false }] }], thyAutoActiveFirstItem: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyAutoActiveFirstItem", required: false }] }], thyMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyMode", required: false }] }], thySize: [{ type: i0.Input, args: [{ isSignal: true, alias: "thySize", required: false }] }], thyEmptyStateText: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyEmptyStateText", required: false }] }], thyEmptySearchMessageText: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyEmptySearchMessageText", required: false }] }], thyEnableScrollLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyEnableScrollLoad", required: false }] }], thyAllowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyAllowClear", required: false }] }], thyDisabled: [{
|
|
966
|
+
}, animations: [scaleXMotion, scaleYMotion, scaleMotion], template: "<div\n cdk-overlay-origin\n thySelectControl\n (click)=\"toggle($event)\"\n #origin=\"cdkOverlayOrigin\"\n #trigger\n [thyPanelOpened]=\"panelOpen\"\n [thySelectedOptions]=\"selectedOptions()\"\n [thyIsMultiple]=\"isMultiple()\"\n [thyShowSearch]=\"thyShowSearch()\"\n [thyAllowClear]=\"thyAllowClear()\"\n [thySize]=\"thySize()\"\n [thyPlaceholder]=\"thyPlaceHolder()\"\n [customDisplayTemplate]=\"selectedValueDisplayRef()\"\n [thyDisabled]=\"disabled\"\n [thyBorderless]=\"thyBorderless()\"\n (thyOnClear)=\"clearSelectValue($event)\"\n (thyOnRemove)=\"remove($event)\"\n (thyOnSearch)=\"search($event)\"\n (thyOnBlur)=\"onBlur($event)\"\n [thyMaxTagCount]=\"thyMaxTagCount()\"\n [thyPreset]=\"thyPreset()\"></div>\n\n<ng-template\n cdk-connected-overlay\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n [cdkConnectedOverlayHasBackdrop]=\"thyHasBackdrop()\"\n [cdkConnectedOverlayPositions]=\"dropDownPositions()\"\n [cdkConnectedOverlayOrigin]=\"thyOrigin() || origin\"\n [cdkConnectedOverlayOpen]=\"panelOpen\"\n [cdkConnectedOverlayWidth]=\"triggerRectWidth()\"\n [cdkConnectedOverlayMinWidth]=\"dropDownMinWidth()\"\n [cdkConnectedOverlayScrollStrategy]=\"scrollStrategy\"\n cdkConnectedOverlayTransformOriginOn=\".thy-select-dropdown\"\n (detach)=\"close()\">\n <div\n thyStopPropagation\n [attr.tabindex]=\"-1\"\n [ngClass]=\"dropDownClass()\"\n [@scaleYMotion]=\"placement() === 'top' || placement() === 'bottom' ? 'enter' : 'void'\"\n [@scaleXMotion]=\"placement() === 'left' || placement() === 'right' ? 'enter' : 'void'\"\n [@scaleMotion]=\"\n placement() !== 'top' && placement() !== 'bottom' && placement() !== 'left' && placement() !== 'right' ? 'enter' : 'void'\n \">\n @if (filteredGroupsAndOptions()?.length > 0) {\n <div\n #panel\n class=\"thy-select-dropdown-options thy-select-dropdown-options-{{ thySize() }} thy-select-dropdown-options-with-virtual-scroll\">\n <cdk-virtual-scroll-viewport\n class=\"thy-select-scroll-viewport\"\n [itemSize]=\"thyItemSize()\"\n [style.height.px]=\"virtualHeight()\"\n (scrolledIndexChange)=\"optionsScrolled($event)\"\n (mouseleave)=\"mouseLeaveOptions()\">\n <ng-template\n cdkVirtualFor\n [cdkVirtualForOf]=\"filteredGroupsAndOptions()\"\n [cdkVirtualForTrackBy]=\"trackByFn\"\n [cdkVirtualForTemplateCacheSize]=\"0\"\n let-item>\n @if (item.type === 'group') {\n <thy-option-group-render [thyGroupLabel]=\"item.label\"></thy-option-group-render>\n } @else {\n <thy-option-render\n [thyValue]=\"item.value\"\n [thyRawValue]=\"item.rawValue\"\n [thyLabelText]=\"item.label\"\n [thyShowOptionCustom]=\"item.showOptionCustom\"\n [thySearchKey]=\"item.searchKey\"\n [thyDisabled]=\"item.disabled\"\n [thyTemplate]=\"item.template\"\n [thyShowCheckedIcon]=\"isMultiple()\"\n [thySelectedValuesMap]=\"selectedValuesMap()\"\n [thyActivatedValue]=\"activatedValue()\"\n (optionHover)=\"optionHover($event)\"\n (optionClick)=\"optionClick($event)\">\n </thy-option-render>\n }\n </ng-template>\n </cdk-virtual-scroll-viewport>\n <ng-content></ng-content>\n </div>\n } @else {\n <thy-loading [thyDone]=\"thyLoadState()\" thySize=\"sm\"></thy-loading>\n <div class=\"thy-select-empty-content\">\n @if (thyLoadState()) {\n @let isSearching = keywords();\n <thy-empty\n [thyMessage]=\"isSearching ? thyEmptySearchMessageText() : thyEmptyStateText()\"\n thySize=\"sm\"\n [thyIconName]=\"emptyIcon()\"></thy-empty>\n }\n </div>\n }\n @if (thyFooterTemplate()) {\n <div [class]=\"thyFooterClass() ? thyFooterClass() : 'thy-custom-select-footer'\">\n @if (thyFooterTemplate()) {\n <ng-template [ngTemplateOutlet]=\"thyFooterTemplate()\"></ng-template>\n }\n </div>\n }\n </div>\n</ng-template>\n" }]
|
|
967
|
+
}], ctorParameters: () => [], propDecorators: { thyDropdownWidthMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyDropdownWidthMode", required: false }] }], thyItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyItemSize", required: false }] }], cdkConnectedOverlay: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkConnectedOverlay), { isSignal: true }] }], thyOnSearch: [{ type: i0.Output, args: ["thyOnSearch"] }], thyOnScrollToBottom: [{ type: i0.Output, args: ["thyOnScrollToBottom"] }], thyOnExpandStatusChange: [{ type: i0.Output, args: ["thyOnExpandStatusChange"] }], thyShowSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyShowSearch", required: false }] }], thyPlaceHolder: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyPlaceHolder", required: false }] }], thyServerSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyServerSearch", required: false }] }], thyLoadState: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyLoadState", required: false }] }], thyAutoActiveFirstItem: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyAutoActiveFirstItem", required: false }] }], thyMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyMode", required: false }] }], thySize: [{ type: i0.Input, args: [{ isSignal: true, alias: "thySize", required: false }] }], thyEmptyStateText: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyEmptyStateText", required: false }] }], thyEmptySearchMessageText: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyEmptySearchMessageText", required: false }] }], thyEnableScrollLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyEnableScrollLoad", required: false }] }], thyAllowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyAllowClear", required: false }] }], thyDisabled: [{
|
|
946
968
|
type: Input,
|
|
947
969
|
args: [{ transform: coerceBooleanProperty }]
|
|
948
970
|
}], thySortComparator: [{ type: i0.Input, args: [{ isSignal: true, alias: "thySortComparator", required: false }] }], thyFooterTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyFooterTemplate", required: false }] }], thyPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyPlacement", required: false }] }], thyOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyOrigin", required: false }] }], thyFooterClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyFooterClass", required: false }] }], selectedValueDisplayRef: [{ type: i0.ContentChild, args: ['selectedDisplay', { isSignal: true }] }], thyAutoExpand: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyAutoExpand", required: false }] }], thyHasBackdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyHasBackdrop", required: false }] }], thyMaxTagCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyMaxTagCount", required: false }] }], thyBorderless: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyBorderless", required: false }] }], cdkVirtualScrollViewport: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }] }], thyOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyOptions", required: false }] }], thyPreset: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyPreset", required: false }] }], trigger: [{
|
|
@@ -973,7 +995,7 @@ class ThyNativeSelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
973
995
|
}
|
|
974
996
|
constructor() {
|
|
975
997
|
super();
|
|
976
|
-
this.selectElement = viewChild('select'
|
|
998
|
+
this.selectElement = viewChild.required('select');
|
|
977
999
|
this.innerValue = model(null, ...(ngDevMode ? [{ debugName: "innerValue" }] : []));
|
|
978
1000
|
this.disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
979
1001
|
this.hostRenderer = useHostRenderer();
|
|
@@ -1004,8 +1026,8 @@ class ThyNativeSelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1004
1026
|
this.innerValue.set('');
|
|
1005
1027
|
this.onChangeFn(this.innerValue());
|
|
1006
1028
|
}
|
|
1007
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1008
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.
|
|
1029
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ThyNativeSelect, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1030
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: ThyNativeSelect, isStandalone: true, selector: "thy-native-select", inputs: { innerValue: { classPropertyName: "innerValue", publicName: "innerValue", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, thyAllowClear: { classPropertyName: "thyAllowClear", publicName: "thyAllowClear", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { innerValue: "innerValueChange" }, host: { listeners: { "focus": "onFocus($event)", "blur": "onBlur($event)" }, properties: { "attr.tabindex": "tabIndex" }, classAttribute: "thy-select" }, providers: [
|
|
1009
1031
|
{
|
|
1010
1032
|
provide: NG_VALUE_ACCESSOR,
|
|
1011
1033
|
useExisting: forwardRef(() => ThyNativeSelect),
|
|
@@ -1013,7 +1035,7 @@ class ThyNativeSelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1013
1035
|
}
|
|
1014
1036
|
], viewQueries: [{ propertyName: "selectElement", first: true, predicate: ["select"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<select\n #select\n thyInput\n [tabindex]=\"-1\"\n [thySize]=\"thySize()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"innerValue\"\n (ngModelChange)=\"ngModelChange()\"\n (blur)=\"onBlur($event)\"\n [class.thy-select-selection-allow-clear]=\"thyAllowClear()\">\n <ng-content></ng-content>\n</select>\n<thy-icon thyIconName=\"angle-down\"></thy-icon>\n@if (thyAllowClear() && innerValue()) {\n <a class=\"thy-select-remove remove-link\" href=\"javascript:;\" (click)=\"clearSelectValue($event)\">\n <thy-icon class=\"remove-link-icon\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </a>\n}\n", dependencies: [{ kind: "directive", type: ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] }); }
|
|
1015
1037
|
}
|
|
1016
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1038
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ThyNativeSelect, decorators: [{
|
|
1017
1039
|
type: Component,
|
|
1018
1040
|
args: [{ selector: 'thy-native-select', providers: [
|
|
1019
1041
|
{
|
|
@@ -1030,8 +1052,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
1030
1052
|
}], ctorParameters: () => [], propDecorators: { selectElement: [{ type: i0.ViewChild, args: ['select', { isSignal: true }] }], innerValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "innerValue", required: false }] }, { type: i0.Output, args: ["innerValueChange"] }], thySize: [{ type: i0.Input, args: [{ isSignal: true, alias: "thySize", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], thyAllowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyAllowClear", required: false }] }] } });
|
|
1031
1053
|
|
|
1032
1054
|
class ThySelectModule {
|
|
1033
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1034
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
1055
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ThySelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1056
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: ThySelectModule, imports: [CommonModule,
|
|
1035
1057
|
FormsModule,
|
|
1036
1058
|
ThyInputModule,
|
|
1037
1059
|
OverlayModule,
|
|
@@ -1043,7 +1065,7 @@ class ThySelectModule {
|
|
|
1043
1065
|
ThyOptionModule,
|
|
1044
1066
|
ThyNativeSelect,
|
|
1045
1067
|
ThySelect], exports: [ThyNativeSelect, ThySelect, ThyOptionModule] }); }
|
|
1046
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
1068
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ThySelectModule, providers: [THY_SELECT_SCROLL_STRATEGY_PROVIDER, THY_SELECT_CONFIG_PROVIDER], imports: [CommonModule,
|
|
1047
1069
|
FormsModule,
|
|
1048
1070
|
ThyInputModule,
|
|
1049
1071
|
OverlayModule,
|
|
@@ -1056,7 +1078,7 @@ class ThySelectModule {
|
|
|
1056
1078
|
ThyNativeSelect,
|
|
1057
1079
|
ThySelect, ThyOptionModule] }); }
|
|
1058
1080
|
}
|
|
1059
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1081
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ThySelectModule, decorators: [{
|
|
1060
1082
|
type: NgModule,
|
|
1061
1083
|
args: [{
|
|
1062
1084
|
imports: [
|