ngx-tethys 19.1.0-next.0 → 19.1.0-next.10
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 +126 -0
- package/README.md +0 -1
- package/action/action.component.d.ts +7 -8
- package/affix/affix.component.d.ts +3 -4
- package/arrow-switcher/arrow-switcher.component.d.ts +5 -1
- package/badge/badge.component.d.ts +1 -1
- package/button/button-group.component.d.ts +5 -12
- package/button/button-icon.component.d.ts +14 -28
- package/button/button.component.d.ts +17 -27
- package/color-picker/coordinates.directive.d.ts +1 -2
- package/date-picker/abstract-picker.component.d.ts +50 -52
- package/date-picker/abstract-picker.directive.d.ts +15 -40
- package/date-picker/base-picker.component.d.ts +12 -40
- package/date-picker/date-picker.config.d.ts +3 -0
- package/date-picker/lib/calendar/calendar-footer.component.d.ts +24 -19
- package/date-picker/lib/calendar/calendar-header.component.d.ts +15 -15
- package/date-picker/lib/calendar/calendar-table.component.d.ts +15 -16
- package/date-picker/lib/date/date-table-cell.component.d.ts +6 -3
- package/date-picker/lib/date/date-table.component.d.ts +2 -3
- package/date-picker/lib/date-carousel/date-carousel.component.d.ts +2 -3
- package/date-picker/lib/decade/decade-header.component.d.ts +2 -5
- package/date-picker/lib/decade/decade-table.component.d.ts +3 -5
- package/date-picker/lib/month/month-table.component.d.ts +1 -2
- package/date-picker/lib/popups/date-popup.component.d.ts +33 -34
- package/date-picker/lib/popups/inner-popup.component.d.ts +22 -29
- package/date-picker/lib/quarter/quarter-table.component.d.ts +1 -4
- package/date-picker/lib/year/year-header.component.d.ts +2 -4
- package/date-picker/lib/year/year-table.component.d.ts +2 -4
- package/date-picker/month-picker.component.d.ts +2 -2
- package/date-picker/picker.component.d.ts +31 -36
- package/date-picker/picker.pipes.d.ts +4 -5
- package/date-picker/picker.util.d.ts +5 -5
- package/date-picker/picker.validators.d.ts +4 -8
- package/date-picker/quarter-picker.component.d.ts +2 -3
- package/date-picker/styles/calendar.scss +1 -1
- package/date-picker/styles/range-picker.scss +1 -0
- package/date-picker/styles/week-picker.scss +1 -0
- package/date-picker/week-picker.component.d.ts +0 -1
- package/date-picker/year-picker.component.d.ts +2 -3
- package/dropdown/dropdown-active.directive.d.ts +4 -5
- package/dropdown/dropdown-menu-item.directive.d.ts +7 -15
- package/dropdown/dropdown-menu.component.d.ts +6 -13
- package/dropdown/dropdown-submenu.component.d.ts +2 -4
- package/dropdown/dropdown.directive.d.ts +15 -25
- package/empty/empty.component.d.ts +2 -1
- package/fesm2022/ngx-tethys-action.mjs +15 -16
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +14 -18
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +15 -3
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +4 -4
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-button.mjs +225 -322
- package/fesm2022/ngx-tethys-button.mjs.map +1 -1
- package/fesm2022/ngx-tethys-carousel.mjs +1 -0
- package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +2 -2
- package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-tethys-collapse.mjs +2 -2
- package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +4 -6
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +2 -2
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-picker.mjs +861 -1078
- package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +5 -5
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +159 -209
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +5 -2
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +68 -88
- package/fesm2022/ngx-tethys-flexible-text.mjs.map +1 -1
- package/fesm2022/ngx-tethys-grid.mjs +10 -15
- package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +26 -6
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-icon.mjs +44 -59
- package/fesm2022/ngx-tethys-icon.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +44 -42
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
- package/fesm2022/ngx-tethys-layout.mjs +291 -334
- package/fesm2022/ngx-tethys-layout.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +183 -217
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-message.mjs +29 -36
- package/fesm2022/ngx-tethys-message.mjs.map +1 -1
- package/fesm2022/ngx-tethys-notify.mjs +33 -41
- package/fesm2022/ngx-tethys-notify.mjs.map +1 -1
- package/fesm2022/ngx-tethys-progress.mjs +7 -11
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +8 -19
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +46 -58
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-rate.mjs +115 -157
- package/fesm2022/ngx-tethys-rate.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +100 -143
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-segment.mjs +84 -103
- package/fesm2022/ngx-tethys-segment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-select.mjs +164 -228
- package/fesm2022/ngx-tethys-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-shared.mjs +423 -586
- package/fesm2022/ngx-tethys-shared.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +1 -2
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slide.mjs +37 -56
- package/fesm2022/ngx-tethys-slide.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-space.mjs +2 -8
- package/fesm2022/ngx-tethys-space.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-strength.mjs +52 -66
- package/fesm2022/ngx-tethys-strength.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -2
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-time-picker.mjs +244 -271
- package/fesm2022/ngx-tethys-time-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tooltip.mjs +109 -93
- package/fesm2022/ngx-tethys-tooltip.mjs.map +1 -1
- package/fesm2022/ngx-tethys-transfer.mjs +98 -119
- package/fesm2022/ngx-tethys-transfer.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +216 -284
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree.mjs +281 -401
- package/fesm2022/ngx-tethys-tree.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +2 -2
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-vote.mjs +53 -99
- package/fesm2022/ngx-tethys-vote.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/flexible-text/flexible-text.component.d.ts +9 -15
- package/grid/flex.d.ts +1 -3
- package/grid/thy-row.directive.d.ts +1 -4
- package/i18n/i18n.d.ts +7 -2
- package/i18n/locales/de-de.d.ts +5 -1
- package/i18n/locales/en-us.d.ts +5 -1
- package/i18n/locales/ja-jp.d.ts +5 -1
- package/i18n/locales/zh-hans.d.ts +5 -1
- package/i18n/locales/zh-hant.d.ts +5 -1
- package/icon/icon.component.d.ts +10 -18
- package/image/image.directive.d.ts +10 -13
- package/image/image.token.d.ts +5 -5
- package/image/preview/image-preview.component.d.ts +2 -2
- package/input-number/input-number.component.d.ts +1 -1
- package/layout/header.component.d.ts +15 -19
- package/layout/layout.component.d.ts +3 -2
- package/layout/sidebar-header.component.d.ts +7 -8
- package/layout/sidebar.component.d.ts +32 -62
- package/list/list-item-meta.component.d.ts +7 -9
- package/list/list-item.component.d.ts +0 -2
- package/list/list.component.d.ts +2 -8
- package/list/selection/selection-list.d.ts +33 -46
- package/message/abstract/abstract-message.component.d.ts +2 -3
- package/message/message-container.component.d.ts +0 -1
- package/message/message.component.d.ts +1 -3
- package/notify/notify-container.component.d.ts +0 -1
- package/notify/notify.component.d.ts +7 -12
- package/package.json +1 -1
- package/progress/progress-circle.component.d.ts +3 -5
- package/progress/progress.component.d.ts +2 -4
- package/property/properties.component.d.ts +0 -2
- package/property/property-item.component.d.ts +3 -10
- package/radio/group/radio-group.component.d.ts +5 -9
- package/rate/rate-item.component.d.ts +8 -11
- package/rate/rate.component.d.ts +18 -29
- package/resizable/resizable.directive.d.ts +20 -32
- package/resizable/resize-handle.component.d.ts +6 -7
- package/resizable/resize-handles.component.d.ts +5 -9
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/segment/segment-item.component.d.ts +9 -15
- package/segment/segment.component.d.ts +11 -15
- package/segment/segment.token.d.ts +4 -3
- package/select/custom-select/custom-select.component.d.ts +33 -56
- package/select/native-select/native-select.component.d.ts +7 -13
- package/shared/base-form-check.component.d.ts +6 -8
- package/shared/directives/string-or-template-outlet.directive.d.ts +5 -6
- package/shared/directives/thy-autofocus.directive.d.ts +4 -6
- package/shared/directives/thy-contextmenu.directive.d.ts +2 -2
- package/shared/directives/thy-ctrl-enter.directive.d.ts +2 -2
- package/shared/directives/thy-enter.directive.d.ts +2 -2
- package/shared/directives/thy-scroll.directive.d.ts +5 -8
- package/shared/directives/thy-show.d.ts +5 -6
- package/shared/directives/thy-stop-propagation.directive.d.ts +4 -4
- package/shared/directives/view-outlet.directive.d.ts +6 -7
- package/shared/ng-transclude.directive.d.ts +2 -3
- package/shared/option/group/option-group.component.d.ts +5 -9
- package/shared/option/list-option/list-option.component.d.ts +9 -13
- package/shared/option/option.component.d.ts +10 -17
- package/shared/option/option.token.d.ts +4 -3
- package/shared/option/options-container.component.d.ts +1 -1
- package/shared/select/select-control/select-control.component.d.ts +38 -53
- package/slide/slide-body/slide-body-section.component.d.ts +2 -6
- package/slide/slide-header/slide-header.component.d.ts +6 -9
- package/space/space.component.d.ts +5 -11
- package/stepper/stepper.component.d.ts +1 -1
- package/strength/strength.component.d.ts +8 -13
- package/table/table-column.component.d.ts +15 -5
- package/time-picker/inner/inner-time-picker.class.d.ts +15 -13
- package/time-picker/inner/inner-time-picker.component.d.ts +26 -26
- package/time-picker/time-picker-panel.component.d.ts +18 -20
- package/time-picker/time-picker.component.d.ts +22 -30
- package/tooltip/tooltip.directive.d.ts +20 -22
- package/transfer/transfer-list.component.d.ts +15 -15
- package/transfer/transfer.component.d.ts +20 -23
- package/tree/tree-abstract.d.ts +5 -5
- package/tree/tree-node.component.d.ts +24 -37
- package/tree/tree.class.d.ts +4 -4
- package/tree/tree.component.d.ts +47 -75
- package/tree/tree.service.d.ts +3 -4
- package/tree-select/tree-select.component.d.ts +54 -71
- package/vote/vote.component.d.ts +13 -33
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { Overlay,
|
|
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,
|
|
4
|
+
import { InjectionToken, inject, NgZone, ElementRef, ChangeDetectorRef, PLATFORM_ID, input, viewChild, output, contentChild, numberAttribute, contentChildren, viewChildren, effect, untracked, forwardRef, HostListener, ViewChildren, ContentChildren, ViewChild, Input, ChangeDetectionStrategy, Component, model, signal, NgModule } from '@angular/core';
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
6
6
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
7
7
|
import { ThyEmpty, ThyEmptyModule } from 'ngx-tethys/empty';
|
|
8
8
|
import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
|
|
9
9
|
import { ThyInputDirective, ThyInputModule } from 'ngx-tethys/input';
|
|
10
10
|
import { ThyLoading, ThyLoadingModule } from 'ngx-tethys/loading';
|
|
11
|
-
import { ThySelectControl, ThyStopPropagationDirective, ThyScrollDirective, ThyOptionsContainer, ThyOption,
|
|
11
|
+
import { ThySelectOptionGroup, ThySelectControl, ThyStopPropagationDirective, ThyScrollDirective, ThyOptionsContainer, ThyOption, THY_OPTION_PARENT_COMPONENT, ThyOptionModule, ThySharedModule, ThySelectCommonModule } from 'ngx-tethys/shared';
|
|
12
12
|
import { TabIndexDisabledControlValueAccessorMixin, ThyClickDispatcher, injectPanelEmptyIcon, ScrollToService, getFlexiblePositions, scaleXMotion, scaleYMotion, scaleMotion } from 'ngx-tethys/core';
|
|
13
|
-
import { ENTER, isFunction, elementMatchClosest, DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, SPACE, hasModifierKey, HOME, END, A, helpers, isArray
|
|
13
|
+
import { ENTER, isFunction, coerceBooleanProperty, elementMatchClosest, DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, SPACE, hasModifierKey, HOME, END, A, helpers, isArray } from 'ngx-tethys/util';
|
|
14
14
|
import { Subject, defer, merge, timer, Observable } from 'rxjs';
|
|
15
15
|
import { map, filter, take, switchMap, takeUntil, startWith, distinctUntilChanged } from 'rxjs/operators';
|
|
16
16
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
17
17
|
import { coerceElement } from '@angular/cdk/coercion';
|
|
18
18
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
19
19
|
import { injectLocale } from 'ngx-tethys/i18n';
|
|
20
|
+
import { outputToObservable } from '@angular/core/rxjs-interop';
|
|
20
21
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
21
22
|
|
|
22
23
|
const THY_SELECT_SCROLL_STRATEGY = new InjectionToken('thy-select-scroll-strategy');
|
|
@@ -50,42 +51,6 @@ const noop$1 = () => { };
|
|
|
50
51
|
* @order 10
|
|
51
52
|
*/
|
|
52
53
|
class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
53
|
-
/**
|
|
54
|
-
* 下拉选择模式
|
|
55
|
-
* @type 'multiple' | ''
|
|
56
|
-
*/
|
|
57
|
-
set thyMode(value) {
|
|
58
|
-
this.mode = value;
|
|
59
|
-
this.instanceSelectionModel();
|
|
60
|
-
this.getPositions();
|
|
61
|
-
this.setDropDownClass();
|
|
62
|
-
}
|
|
63
|
-
get thyMode() {
|
|
64
|
-
return this.mode;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* 操作图标类型
|
|
68
|
-
* @type primary | success | danger | warning
|
|
69
|
-
* @default primary
|
|
70
|
-
*/
|
|
71
|
-
get thySize() {
|
|
72
|
-
return this.size;
|
|
73
|
-
}
|
|
74
|
-
set thySize(value) {
|
|
75
|
-
this.size = value;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* 数据为空时显示的提示文字
|
|
79
|
-
*/
|
|
80
|
-
set thyEmptyStateText(value) {
|
|
81
|
-
this.emptyStateText = value;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 搜索结果为空时显示的提示文字
|
|
85
|
-
*/
|
|
86
|
-
set thyEmptySearchMessageText(value) {
|
|
87
|
-
this.emptySearchMessageText = value;
|
|
88
|
-
}
|
|
89
54
|
/**
|
|
90
55
|
* 是否禁用
|
|
91
56
|
* @default false
|
|
@@ -96,18 +61,6 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
96
61
|
get thyDisabled() {
|
|
97
62
|
return this.disabled;
|
|
98
63
|
}
|
|
99
|
-
/**
|
|
100
|
-
* option 列表
|
|
101
|
-
* @type ThySelectOptionModel[]
|
|
102
|
-
*/
|
|
103
|
-
set thyOptions(value) {
|
|
104
|
-
if (value === null) {
|
|
105
|
-
value = [];
|
|
106
|
-
}
|
|
107
|
-
this.innerOptions = value;
|
|
108
|
-
this.isReactiveDriven = true;
|
|
109
|
-
this.buildReactiveOptions();
|
|
110
|
-
}
|
|
111
64
|
handleKeydown(event) {
|
|
112
65
|
if (!this.disabled) {
|
|
113
66
|
if (event.keyCode === ENTER) {
|
|
@@ -136,7 +89,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
136
89
|
}
|
|
137
90
|
}
|
|
138
91
|
get placement() {
|
|
139
|
-
return this.thyPlacement || this.config.placement;
|
|
92
|
+
return this.thyPlacement() || this.config.placement;
|
|
140
93
|
}
|
|
141
94
|
constructor() {
|
|
142
95
|
super();
|
|
@@ -152,12 +105,15 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
152
105
|
this.emptyIcon = injectPanelEmptyIcon();
|
|
153
106
|
this.disabled = false;
|
|
154
107
|
this.mode = '';
|
|
155
|
-
this.emptyStateText = this.locale().empty;
|
|
156
|
-
this.emptySearchMessageText = this.locale().empty;
|
|
157
108
|
this.scrollTop = 0;
|
|
158
109
|
this.modalValue = null;
|
|
159
110
|
this.defaultOffset = 4;
|
|
160
111
|
this.dropDownMinWidth = null;
|
|
112
|
+
/**
|
|
113
|
+
* 设置下拉框的最小宽度,默认值 `match-select`,表示与输入框的宽度一致;`min-width` 表示最小宽度为200px;支持自定义最小宽度,比如传 `{minWidth: 150}` 表示最小宽度为150px
|
|
114
|
+
* @default match-select
|
|
115
|
+
*/
|
|
116
|
+
this.thyDropdownWidthMode = input();
|
|
161
117
|
/**
|
|
162
118
|
* 手动聚焦中的标识
|
|
163
119
|
*/
|
|
@@ -165,74 +121,152 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
165
121
|
this.destroy$ = new Subject();
|
|
166
122
|
this.optionSelectionChanges = defer(() => {
|
|
167
123
|
if (this.options) {
|
|
168
|
-
return merge(...this.options.map(option => option.selectionChange));
|
|
124
|
+
return merge(...this.options.map(option => outputToObservable(option.selectionChange)));
|
|
169
125
|
}
|
|
170
126
|
return this.ngZone.onStable.asObservable().pipe(take(1), switchMap(() => this.optionSelectionChanges));
|
|
171
127
|
});
|
|
172
|
-
this.
|
|
173
|
-
this.isSelect = true;
|
|
128
|
+
this.cdkConnectedOverlay = viewChild(CdkConnectedOverlay);
|
|
174
129
|
this.panelOpen = false;
|
|
175
130
|
/**
|
|
176
131
|
* 搜索时回调
|
|
177
132
|
*/
|
|
178
|
-
this.thyOnSearch =
|
|
133
|
+
this.thyOnSearch = output();
|
|
179
134
|
/**
|
|
180
135
|
* 下拉菜单滚动到底部事件,可以用这个事件实现滚动加载
|
|
181
136
|
*/
|
|
182
|
-
this.thyOnScrollToBottom =
|
|
137
|
+
this.thyOnScrollToBottom = output();
|
|
183
138
|
/**
|
|
184
139
|
* 下拉菜单展开和折叠状态事件
|
|
185
140
|
*/
|
|
186
|
-
this.thyOnExpandStatusChange =
|
|
141
|
+
this.thyOnExpandStatusChange = output();
|
|
142
|
+
/**
|
|
143
|
+
* 下拉列表是否显示搜索框
|
|
144
|
+
*/
|
|
145
|
+
this.thyShowSearch = input(false, { transform: coerceBooleanProperty });
|
|
187
146
|
/**
|
|
188
147
|
* 选择框默认文字
|
|
189
148
|
*/
|
|
190
|
-
this.thyPlaceHolder = this.locale().placeholder;
|
|
149
|
+
this.thyPlaceHolder = input(this.locale().placeholder);
|
|
150
|
+
/**
|
|
151
|
+
* 是否使用服务端搜索,当为 true 时,将不再在前端进行过滤
|
|
152
|
+
*/
|
|
153
|
+
this.thyServerSearch = input(false, { transform: coerceBooleanProperty });
|
|
191
154
|
/**
|
|
192
155
|
* 异步加载 loading 状态,false 表示加载中,true 表示加载完成
|
|
193
156
|
*/
|
|
194
|
-
this.thyLoadState = true;
|
|
157
|
+
this.thyLoadState = input(true, { transform: coerceBooleanProperty });
|
|
195
158
|
/**
|
|
196
159
|
* 是否自动设置选项第一条为高亮状态
|
|
197
160
|
*/
|
|
198
|
-
this.thyAutoActiveFirstItem = true;
|
|
161
|
+
this.thyAutoActiveFirstItem = input(true, { transform: coerceBooleanProperty });
|
|
162
|
+
/**
|
|
163
|
+
* 下拉选择模式
|
|
164
|
+
* @type 'multiple' | ''
|
|
165
|
+
*/
|
|
166
|
+
this.thyMode = input('');
|
|
167
|
+
/**
|
|
168
|
+
* 操作图标类型
|
|
169
|
+
* @type primary | success | danger | warning
|
|
170
|
+
* @default primary
|
|
171
|
+
*/
|
|
172
|
+
this.thySize = input();
|
|
173
|
+
/**
|
|
174
|
+
* 数据为空时显示的提示文字
|
|
175
|
+
*/
|
|
176
|
+
this.thyEmptyStateText = input(this.locale().empty, { transform: (value) => value || this.locale().empty });
|
|
177
|
+
/**
|
|
178
|
+
* 搜索结果为空时显示的提示文字
|
|
179
|
+
*/
|
|
180
|
+
this.thyEmptySearchMessageText = input(this.locale().empty, { transform: (value) => value || this.locale().empty });
|
|
199
181
|
/**
|
|
200
182
|
* 滚动加载是否可用,只能当这个参数可以,下面的thyOnScrollToBottom事件才会触发
|
|
201
183
|
*/
|
|
202
|
-
this.thyEnableScrollLoad = false;
|
|
184
|
+
this.thyEnableScrollLoad = input(false, { transform: coerceBooleanProperty });
|
|
203
185
|
/**
|
|
204
186
|
* 单选( thyMode="" 或者不设置)时,选择框支持清除
|
|
205
187
|
*/
|
|
206
|
-
this.thyAllowClear = false;
|
|
188
|
+
this.thyAllowClear = input(false, { transform: coerceBooleanProperty });
|
|
189
|
+
/**
|
|
190
|
+
* 排序比较函数
|
|
191
|
+
*/
|
|
192
|
+
this.thySortComparator = input();
|
|
193
|
+
/**
|
|
194
|
+
* Footer 模板,默认值为空不显示 Footer
|
|
195
|
+
*/
|
|
196
|
+
this.thyFooterTemplate = input();
|
|
197
|
+
/**
|
|
198
|
+
* 弹出位置
|
|
199
|
+
* @type ThyPlacement
|
|
200
|
+
*/
|
|
201
|
+
this.thyPlacement = input();
|
|
202
|
+
/**
|
|
203
|
+
* 自定义 Overlay Origin
|
|
204
|
+
*/
|
|
205
|
+
this.thyOrigin = input();
|
|
207
206
|
/**
|
|
208
207
|
* 自定义 Footer 模板容器 class
|
|
209
208
|
*/
|
|
210
|
-
this.thyFooterClass = 'thy-custom-select-footer';
|
|
209
|
+
this.thyFooterClass = input('thy-custom-select-footer');
|
|
210
|
+
/**
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
this.selectedValueDisplayRef = contentChild('selectedDisplay');
|
|
214
|
+
/**
|
|
215
|
+
* 初始化时,是否展开面板
|
|
216
|
+
*/
|
|
217
|
+
this.thyAutoExpand = input(false, { transform: coerceBooleanProperty });
|
|
211
218
|
/**
|
|
212
219
|
* 是否弹出透明遮罩,如果显示遮罩则会阻止滚动区域滚动
|
|
213
220
|
*/
|
|
214
|
-
this.thyHasBackdrop = false;
|
|
221
|
+
this.thyHasBackdrop = input(false, { transform: coerceBooleanProperty });
|
|
215
222
|
/**
|
|
216
223
|
* 设置多选时最大显示的标签数量,0 表示不限制
|
|
217
224
|
*/
|
|
218
|
-
this.thyMaxTagCount = 0;
|
|
225
|
+
this.thyMaxTagCount = input(0, { transform: numberAttribute });
|
|
219
226
|
/**
|
|
220
227
|
* 是否隐藏选择框边框
|
|
221
|
-
* @default false
|
|
222
228
|
*/
|
|
223
|
-
this.thyBorderless = false;
|
|
229
|
+
this.thyBorderless = input(false, { transform: coerceBooleanProperty });
|
|
224
230
|
this.isReactiveDriven = false;
|
|
225
231
|
this.optionGroups = [];
|
|
232
|
+
/**
|
|
233
|
+
* option 列表
|
|
234
|
+
*/
|
|
235
|
+
this.thyOptions = input(undefined, {
|
|
236
|
+
transform: (value) => {
|
|
237
|
+
if (value === null) {
|
|
238
|
+
value = [];
|
|
239
|
+
}
|
|
240
|
+
this.innerOptions = value;
|
|
241
|
+
this.isReactiveDriven = true;
|
|
242
|
+
this.buildReactiveOptions();
|
|
243
|
+
return value;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
226
246
|
/**
|
|
227
247
|
* 目前只支持多选选中项的展示,默认为空,渲染文字模板,传入tag,渲染展示模板,
|
|
228
248
|
* @default ''|tag
|
|
229
249
|
*/
|
|
230
|
-
this.thyPreset = '';
|
|
250
|
+
this.thyPreset = input('');
|
|
251
|
+
this.panel = viewChild('panel');
|
|
252
|
+
/**
|
|
253
|
+
* @private
|
|
254
|
+
*/
|
|
255
|
+
this.contentGroups = contentChildren(ThySelectOptionGroup);
|
|
256
|
+
this.viewGroups = viewChildren(ThySelectOptionGroup);
|
|
231
257
|
this.isSearching = false;
|
|
232
258
|
this.groupBy = (item) => item.groupLabel;
|
|
233
259
|
const selectConfig = this.selectConfig;
|
|
234
260
|
this.config = { ...DEFAULT_SELECT_CONFIG, ...selectConfig };
|
|
235
261
|
this.buildScrollStrategy();
|
|
262
|
+
effect(() => {
|
|
263
|
+
this.mode = this.thyMode();
|
|
264
|
+
untracked(() => {
|
|
265
|
+
this.instanceSelectionModel();
|
|
266
|
+
this.getPositions();
|
|
267
|
+
this.setDropDownClass();
|
|
268
|
+
});
|
|
269
|
+
});
|
|
236
270
|
}
|
|
237
271
|
writeValue(value) {
|
|
238
272
|
this.modalValue = value;
|
|
@@ -294,7 +328,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
294
328
|
}
|
|
295
329
|
}
|
|
296
330
|
getDropdownMinWidth() {
|
|
297
|
-
const mode = this.thyDropdownWidthMode || this.config.dropdownWidthMode;
|
|
331
|
+
const mode = this.thyDropdownWidthMode() || this.config.dropdownWidthMode;
|
|
298
332
|
let dropdownMinWidth = null;
|
|
299
333
|
if (mode?.minWidth) {
|
|
300
334
|
dropdownMinWidth = mode.minWidth;
|
|
@@ -331,12 +365,12 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
331
365
|
.asObservable()
|
|
332
366
|
.pipe(take(1))
|
|
333
367
|
.subscribe(() => {
|
|
334
|
-
if (this.cdkConnectedOverlay && this.cdkConnectedOverlay.overlayRef) {
|
|
335
|
-
this.cdkConnectedOverlay.overlayRef.updatePosition();
|
|
368
|
+
if (this.cdkConnectedOverlay() && this.cdkConnectedOverlay().overlayRef) {
|
|
369
|
+
this.cdkConnectedOverlay().overlayRef.updatePosition();
|
|
336
370
|
}
|
|
337
371
|
});
|
|
338
372
|
});
|
|
339
|
-
if (this.thyAutoExpand) {
|
|
373
|
+
if (this.thyAutoExpand()) {
|
|
340
374
|
timer(0).subscribe(() => {
|
|
341
375
|
this.changeDetectorRef.markForCheck();
|
|
342
376
|
this.open();
|
|
@@ -345,18 +379,20 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
345
379
|
}
|
|
346
380
|
}
|
|
347
381
|
get isHiddenOptions() {
|
|
348
|
-
return this.options.toArray().every(option => option.hidden);
|
|
382
|
+
return this.options.toArray().every(option => option.hidden());
|
|
349
383
|
}
|
|
350
384
|
onAttached() {
|
|
351
|
-
this.cdkConnectedOverlay
|
|
352
|
-
|
|
385
|
+
this.cdkConnectedOverlay()
|
|
386
|
+
.positionChange.pipe(take(1))
|
|
387
|
+
.subscribe(() => {
|
|
388
|
+
if (this.panel()) {
|
|
353
389
|
if (this.keyManager.activeItem) {
|
|
354
|
-
ScrollToService.scrollToElement(this.keyManager.activeItem.element.nativeElement, this.panel.nativeElement);
|
|
390
|
+
ScrollToService.scrollToElement(this.keyManager.activeItem.element.nativeElement, this.panel().nativeElement);
|
|
355
391
|
this.changeDetectorRef.detectChanges();
|
|
356
392
|
}
|
|
357
393
|
else {
|
|
358
394
|
if (!this.empty) {
|
|
359
|
-
ScrollToService.scrollToElement(this.selectionModel.selected[0].element.nativeElement, this.panel.nativeElement);
|
|
395
|
+
ScrollToService.scrollToElement(this.selectionModel.selected[0].element.nativeElement, this.panel().nativeElement);
|
|
360
396
|
this.changeDetectorRef.detectChanges();
|
|
361
397
|
}
|
|
362
398
|
}
|
|
@@ -371,16 +407,14 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
371
407
|
onOptionsScrolled(elementRef) {
|
|
372
408
|
const scroll = elementRef.nativeElement.scrollTop, height = elementRef.nativeElement.clientHeight, scrollHeight = elementRef.nativeElement.scrollHeight;
|
|
373
409
|
if (scroll + height + 10 >= scrollHeight) {
|
|
374
|
-
|
|
375
|
-
this.
|
|
376
|
-
|
|
377
|
-
});
|
|
378
|
-
}
|
|
410
|
+
this.ngZone.run(() => {
|
|
411
|
+
this.thyOnScrollToBottom.emit();
|
|
412
|
+
});
|
|
379
413
|
}
|
|
380
414
|
}
|
|
381
415
|
onSearchFilter(searchText) {
|
|
382
416
|
searchText = searchText.trim();
|
|
383
|
-
if (this.thyServerSearch) {
|
|
417
|
+
if (this.thyServerSearch()) {
|
|
384
418
|
this.isSearching = true;
|
|
385
419
|
this.thyOnSearch.emit(searchText);
|
|
386
420
|
}
|
|
@@ -408,7 +442,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
408
442
|
onFocus(event) {
|
|
409
443
|
// thyShowSearch 与 panelOpen 均为 true 时,点击 thySelectControl 需要触发自动聚焦到 input 的逻辑
|
|
410
444
|
// manualFocusing 如果是手动聚焦,不触发自动聚焦到 input 的逻辑
|
|
411
|
-
if ((this.thyShowSearch && this.panelOpen) ||
|
|
445
|
+
if ((this.thyShowSearch() && this.panelOpen) ||
|
|
412
446
|
(!this.manualFocusing &&
|
|
413
447
|
!elementMatchClosest(event?.relatedTarget, ['.thy-select-dropdown', 'thy-custom-select']))) {
|
|
414
448
|
const inputElement = this.elementRef.nativeElement.querySelector('input');
|
|
@@ -448,8 +482,8 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
448
482
|
}
|
|
449
483
|
updateCdkConnectedOverlayPositions() {
|
|
450
484
|
setTimeout(() => {
|
|
451
|
-
if (this.cdkConnectedOverlay && this.cdkConnectedOverlay.overlayRef) {
|
|
452
|
-
this.cdkConnectedOverlay.overlayRef.updatePosition();
|
|
485
|
+
if (this.cdkConnectedOverlay() && this.cdkConnectedOverlay().overlayRef) {
|
|
486
|
+
this.cdkConnectedOverlay().overlayRef.updatePosition();
|
|
453
487
|
}
|
|
454
488
|
});
|
|
455
489
|
}
|
|
@@ -463,12 +497,12 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
463
497
|
return !this.selectionModel || this.selectionModel.isEmpty();
|
|
464
498
|
}
|
|
465
499
|
getItemCount() {
|
|
466
|
-
const group = this.isReactiveDriven ? this.viewGroups : this.contentGroups;
|
|
500
|
+
const group = this.isReactiveDriven ? this.viewGroups() : this.contentGroups();
|
|
467
501
|
return this.options.length + group.length;
|
|
468
502
|
}
|
|
469
503
|
toggle(event) {
|
|
470
504
|
if (this.panelOpen) {
|
|
471
|
-
if (!this.thyShowSearch) {
|
|
505
|
+
if (!this.thyShowSearch()) {
|
|
472
506
|
this.close();
|
|
473
507
|
}
|
|
474
508
|
}
|
|
@@ -522,7 +556,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
522
556
|
return;
|
|
523
557
|
}
|
|
524
558
|
if (this.empty) {
|
|
525
|
-
if (!this.thyAutoActiveFirstItem) {
|
|
559
|
+
if (!this.thyAutoActiveFirstItem()) {
|
|
526
560
|
return;
|
|
527
561
|
}
|
|
528
562
|
this.keyManager.setFirstItemActive();
|
|
@@ -532,7 +566,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
532
566
|
}
|
|
533
567
|
}
|
|
534
568
|
else {
|
|
535
|
-
if (!this.thyAutoActiveFirstItem) {
|
|
569
|
+
if (!this.thyAutoActiveFirstItem()) {
|
|
536
570
|
return;
|
|
537
571
|
}
|
|
538
572
|
// always set first option active
|
|
@@ -554,9 +588,9 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
554
588
|
this.close();
|
|
555
589
|
});
|
|
556
590
|
this.keyManager.change.pipe(takeUntil(this.destroy$)).subscribe(() => {
|
|
557
|
-
if (this.panelOpen && this.panel) {
|
|
591
|
+
if (this.panelOpen && this.panel()) {
|
|
558
592
|
if (this.keyManager.activeItem) {
|
|
559
|
-
ScrollToService.scrollToElement(this.keyManager.activeItem.element.nativeElement, this.panel.nativeElement);
|
|
593
|
+
ScrollToService.scrollToElement(this.keyManager.activeItem.element.nativeElement, this.panel().nativeElement);
|
|
560
594
|
}
|
|
561
595
|
}
|
|
562
596
|
else if (!this.panelOpen && !this.isMultiple && this.keyManager.activeItem) {
|
|
@@ -608,7 +642,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
608
642
|
}
|
|
609
643
|
else if (this.isMultiple && keyCode === A && event.ctrlKey) {
|
|
610
644
|
event.preventDefault();
|
|
611
|
-
const hasDeselectedOptions = this.options.some(opt => !opt.disabled && !opt.selected);
|
|
645
|
+
const hasDeselectedOptions = this.options.some(opt => !opt.disabled && !opt.selected());
|
|
612
646
|
this.options.forEach(option => {
|
|
613
647
|
if (!option.disabled) {
|
|
614
648
|
hasDeselectedOptions ? option.select() : option.deselect();
|
|
@@ -631,7 +665,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
631
665
|
}
|
|
632
666
|
}
|
|
633
667
|
getPositions() {
|
|
634
|
-
this.dropDownPositions = getFlexiblePositions(this.thyPlacement || this.config.placement, this.defaultOffset);
|
|
668
|
+
this.dropDownPositions = getFlexiblePositions(this.thyPlacement() || this.config.placement, this.defaultOffset);
|
|
635
669
|
}
|
|
636
670
|
instanceSelectionModel() {
|
|
637
671
|
if (this.selectionModel) {
|
|
@@ -713,8 +747,8 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
713
747
|
this.selectionModel.clear();
|
|
714
748
|
}
|
|
715
749
|
else {
|
|
716
|
-
if (wasSelected !== option.selected) {
|
|
717
|
-
option.selected ? this.selectionModel.select(option) : this.selectionModel.deselect(option);
|
|
750
|
+
if (wasSelected !== option.selected()) {
|
|
751
|
+
option.selected() ? this.selectionModel.select(option) : this.selectionModel.deselect(option);
|
|
718
752
|
}
|
|
719
753
|
if (isUserInput) {
|
|
720
754
|
this.keyManager.setActiveItem(option);
|
|
@@ -737,15 +771,15 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
737
771
|
sortValues() {
|
|
738
772
|
if (this.isMultiple) {
|
|
739
773
|
const options = this.options.toArray();
|
|
740
|
-
if (this.thySortComparator) {
|
|
774
|
+
if (this.thySortComparator()) {
|
|
741
775
|
this.selectionModel.sort((a, b) => {
|
|
742
|
-
return this.thySortComparator(a, b, options);
|
|
776
|
+
return this.thySortComparator()(a, b, options);
|
|
743
777
|
});
|
|
744
778
|
}
|
|
745
779
|
}
|
|
746
780
|
}
|
|
747
781
|
getOriginRectWidth() {
|
|
748
|
-
return this.thyOrigin ? coerceElement(this.thyOrigin).offsetWidth : this.trigger.nativeElement.offsetWidth;
|
|
782
|
+
return this.thyOrigin() ? coerceElement(this.thyOrigin()).offsetWidth : this.trigger.nativeElement.offsetWidth;
|
|
749
783
|
}
|
|
750
784
|
subscribeTriggerResize() {
|
|
751
785
|
this.unsubscribeTriggerResize();
|
|
@@ -780,7 +814,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
780
814
|
this.destroy$.complete();
|
|
781
815
|
}
|
|
782
816
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelect, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
783
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySelect, isStandalone: true, selector: "thy-select,thy-custom-select", inputs: { thyDropdownWidthMode: "thyDropdownWidthMode", thyShowSearch:
|
|
817
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySelect, isStandalone: true, selector: "thy-select,thy-custom-select", inputs: { thyDropdownWidthMode: { classPropertyName: "thyDropdownWidthMode", publicName: "thyDropdownWidthMode", 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": "handleKeydown($event)" }, properties: { "class.thy-select-custom": "true", "class.thy-select": "true", "class.menu-is-opened": "panelOpen", "attr.tabindex": "tabIndex" } }, providers: [
|
|
784
818
|
{
|
|
785
819
|
provide: THY_OPTION_PARENT_COMPONENT,
|
|
786
820
|
useExisting: ThySelect
|
|
@@ -790,7 +824,7 @@ class ThySelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
790
824
|
useExisting: forwardRef(() => ThySelect),
|
|
791
825
|
multi: true
|
|
792
826
|
}
|
|
793
|
-
], queries: [{ propertyName: "selectedValueDisplayRef", first: true, predicate: ["selectedDisplay"], descendants: true }, { propertyName: "
|
|
827
|
+
], queries: [{ propertyName: "selectedValueDisplayRef", first: true, predicate: ["selectedDisplay"], descendants: true, isSignal: true }, { propertyName: "contentGroups", predicate: ThySelectOptionGroup, isSignal: true }, { propertyName: "contentOptions", predicate: ThyOption, descendants: true }], viewQueries: [{ propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "viewGroups", predicate: ThySelectOptionGroup, descendants: true, isSignal: true }, { propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, read: ElementRef, static: true }, { propertyName: "viewOptions", predicate: ThyOption, 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]=\"selected\"\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)=\"onSearchFilter($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 (attach)=\"onAttached()\"\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]=\"placement !== 'top' && placement !== 'bottom' && placement !== 'left' && placement !== 'right' ? 'enter' : 'void'\"\n (mousemove)=\"dropDownMouseMove($event)\">\n @if (contentOptions?.length > 0 || contentGroups?.length > 0 || innerOptions?.length > 0) {\n <div\n #panel\n class=\"thy-select-dropdown-options thy-select-dropdown-options-{{ thySize() }}\"\n thyScroll\n (thyOnScrolled)=\"onOptionsScrolled($event)\"\n [thyEnable]=\"thyEnableScrollLoad()\">\n @if (isReactiveDriven) {\n <ng-template [ngTemplateOutlet]=\"optionsContainer.optionsTemplate()\"></ng-template>\n }\n <ng-content></ng-content>\n @if (isHiddenOptions) {\n <thy-loading [thyDone]=\"thyLoadState()\" thySize=\"sm\"></thy-loading>\n <div class=\"thy-select-empty-content\">\n @if (thyLoadState()) {\n <thy-empty [thyMessage]=\"thyEmptySearchMessageText()\" thySize=\"sm\" [thyIconName]=\"emptyIcon()\"></thy-empty>\n }\n </div>\n }\n </div>\n } @else {\n <thy-loading [thyDone]=\"thyLoadState()\" thySize=\"sm\"></thy-loading>\n <div class=\"thy-select-empty-content\">\n @if (thyLoadState()) {\n <thy-empty [thyMessage]=\"thyEmptyStateText()\" thySize=\"sm\" [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\n<thy-options-container #optionsContainer>\n @for (option of optionGroups; track $index) {\n @if (!option.children) {\n <thy-option\n [thyDisabled]=\"option.disabled\"\n [thyLabelText]=\"option.label\"\n [thyValue]=\"option.value\"\n [thyRawValue]=\"option\"></thy-option>\n } @else {\n <thy-option-group [thyGroupLabel]=\"option.groupLabel\">\n @for (sub of option.children; track sub.value) {\n <thy-option [thyDisabled]=\"sub.disabled\" [thyLabelText]=\"sub.label\" [thyValue]=\"sub.value\" [thyRawValue]=\"sub\"></thy-option>\n }\n </thy-option-group>\n }\n }\n</thy-options-container>\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: "directive", type: ThyScrollDirective, selector: "[thyScroll]", inputs: ["thyEnable"], outputs: ["thyOnScrolled"] }, { 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: ThyOptionsContainer, selector: "thy-options-container" }, { kind: "component", type: ThyOption, selector: "thy-option", inputs: ["thyValue", "thyRawValue", "thyLabelText", "thyShowOptionCustom", "thySearchKey", "thyDisabled"], outputs: ["selectionChange", "visibleChange"] }, { kind: "component", type: ThySelectOptionGroup, selector: "thy-option-group", inputs: ["thyDisabled", "thyGroupLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [scaleXMotion, scaleYMotion, scaleMotion], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
794
828
|
}
|
|
795
829
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelect, decorators: [{
|
|
796
830
|
type: Component,
|
|
@@ -818,108 +852,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
818
852
|
ThySelectOptionGroup,
|
|
819
853
|
NgTemplateOutlet
|
|
820
854
|
], host: {
|
|
855
|
+
'[class.thy-select-custom]': 'true',
|
|
856
|
+
'[class.thy-select]': 'true',
|
|
857
|
+
'[class.menu-is-opened]': 'panelOpen',
|
|
821
858
|
'[attr.tabindex]': 'tabIndex',
|
|
822
859
|
'(focus)': 'onFocus($event)',
|
|
823
860
|
'(blur)': 'onBlur($event)'
|
|
824
|
-
}, 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]=\"selected\"\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)=\"onSearchFilter($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 (attach)=\"onAttached()\"\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]=\"placement !== 'top' && placement !== 'bottom' && placement !== 'left' && placement !== 'right' ? 'enter' : 'void'\"\n (mousemove)=\"dropDownMouseMove($event)\">\n @if (contentOptions?.length > 0 || contentGroups?.length > 0 || innerOptions?.length > 0) {\n <div\n #panel\n class=\"thy-select-dropdown-options thy-select-dropdown-options-{{
|
|
825
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
826
|
-
type: Input
|
|
827
|
-
}], cdkConnectedOverlay: [{
|
|
828
|
-
type: ViewChild,
|
|
829
|
-
args: [CdkConnectedOverlay, { static: true }]
|
|
830
|
-
}], isSelectCustom: [{
|
|
831
|
-
type: HostBinding,
|
|
832
|
-
args: ['class.thy-select-custom']
|
|
833
|
-
}], isSelect: [{
|
|
834
|
-
type: HostBinding,
|
|
835
|
-
args: ['class.thy-select']
|
|
836
|
-
}], panelOpen: [{
|
|
837
|
-
type: HostBinding,
|
|
838
|
-
args: ['class.menu-is-opened']
|
|
839
|
-
}], thyOnSearch: [{
|
|
840
|
-
type: Output
|
|
841
|
-
}], thyOnScrollToBottom: [{
|
|
842
|
-
type: Output
|
|
843
|
-
}], thyOnExpandStatusChange: [{
|
|
844
|
-
type: Output
|
|
845
|
-
}], thyShowSearch: [{
|
|
846
|
-
type: Input,
|
|
847
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
848
|
-
}], thyPlaceHolder: [{
|
|
849
|
-
type: Input
|
|
850
|
-
}], thyServerSearch: [{
|
|
851
|
-
type: Input,
|
|
852
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
853
|
-
}], thyLoadState: [{
|
|
854
|
-
type: Input,
|
|
855
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
856
|
-
}], thyAutoActiveFirstItem: [{
|
|
861
|
+
}, 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]=\"selected\"\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)=\"onSearchFilter($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 (attach)=\"onAttached()\"\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]=\"placement !== 'top' && placement !== 'bottom' && placement !== 'left' && placement !== 'right' ? 'enter' : 'void'\"\n (mousemove)=\"dropDownMouseMove($event)\">\n @if (contentOptions?.length > 0 || contentGroups?.length > 0 || innerOptions?.length > 0) {\n <div\n #panel\n class=\"thy-select-dropdown-options thy-select-dropdown-options-{{ thySize() }}\"\n thyScroll\n (thyOnScrolled)=\"onOptionsScrolled($event)\"\n [thyEnable]=\"thyEnableScrollLoad()\">\n @if (isReactiveDriven) {\n <ng-template [ngTemplateOutlet]=\"optionsContainer.optionsTemplate()\"></ng-template>\n }\n <ng-content></ng-content>\n @if (isHiddenOptions) {\n <thy-loading [thyDone]=\"thyLoadState()\" thySize=\"sm\"></thy-loading>\n <div class=\"thy-select-empty-content\">\n @if (thyLoadState()) {\n <thy-empty [thyMessage]=\"thyEmptySearchMessageText()\" thySize=\"sm\" [thyIconName]=\"emptyIcon()\"></thy-empty>\n }\n </div>\n }\n </div>\n } @else {\n <thy-loading [thyDone]=\"thyLoadState()\" thySize=\"sm\"></thy-loading>\n <div class=\"thy-select-empty-content\">\n @if (thyLoadState()) {\n <thy-empty [thyMessage]=\"thyEmptyStateText()\" thySize=\"sm\" [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\n<thy-options-container #optionsContainer>\n @for (option of optionGroups; track $index) {\n @if (!option.children) {\n <thy-option\n [thyDisabled]=\"option.disabled\"\n [thyLabelText]=\"option.label\"\n [thyValue]=\"option.value\"\n [thyRawValue]=\"option\"></thy-option>\n } @else {\n <thy-option-group [thyGroupLabel]=\"option.groupLabel\">\n @for (sub of option.children; track sub.value) {\n <thy-option [thyDisabled]=\"sub.disabled\" [thyLabelText]=\"sub.label\" [thyValue]=\"sub.value\" [thyRawValue]=\"sub\"></thy-option>\n }\n </thy-option-group>\n }\n }\n</thy-options-container>\n" }]
|
|
862
|
+
}], ctorParameters: () => [], propDecorators: { thyDisabled: [{
|
|
857
863
|
type: Input,
|
|
858
864
|
args: [{ transform: coerceBooleanProperty }]
|
|
859
|
-
}], thyMode: [{
|
|
860
|
-
type: Input
|
|
861
|
-
}], thySize: [{
|
|
862
|
-
type: Input
|
|
863
|
-
}], thyEmptyStateText: [{
|
|
864
|
-
type: Input
|
|
865
|
-
}], thyEmptySearchMessageText: [{
|
|
866
|
-
type: Input
|
|
867
|
-
}], thyEnableScrollLoad: [{
|
|
868
|
-
type: Input,
|
|
869
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
870
|
-
}], thyAllowClear: [{
|
|
871
|
-
type: Input,
|
|
872
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
873
|
-
}], thyDisabled: [{
|
|
874
|
-
type: Input,
|
|
875
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
876
|
-
}], thySortComparator: [{
|
|
877
|
-
type: Input
|
|
878
|
-
}], thyFooterTemplate: [{
|
|
879
|
-
type: Input
|
|
880
|
-
}], thyPlacement: [{
|
|
881
|
-
type: Input
|
|
882
|
-
}], thyOrigin: [{
|
|
883
|
-
type: Input
|
|
884
|
-
}], thyFooterClass: [{
|
|
885
|
-
type: Input
|
|
886
|
-
}], selectedValueDisplayRef: [{
|
|
887
|
-
type: ContentChild,
|
|
888
|
-
args: ['selectedDisplay']
|
|
889
|
-
}], thyAutoExpand: [{
|
|
890
|
-
type: Input,
|
|
891
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
892
|
-
}], thyHasBackdrop: [{
|
|
893
|
-
type: Input,
|
|
894
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
895
|
-
}], thyMaxTagCount: [{
|
|
896
|
-
type: Input,
|
|
897
|
-
args: [{ transform: numberAttribute }]
|
|
898
|
-
}], thyBorderless: [{
|
|
899
|
-
type: Input,
|
|
900
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
901
|
-
}], thyOptions: [{
|
|
902
|
-
type: Input
|
|
903
|
-
}], thyPreset: [{
|
|
904
|
-
type: Input
|
|
905
865
|
}], trigger: [{
|
|
906
866
|
type: ViewChild,
|
|
907
867
|
args: ['trigger', { read: ElementRef, static: true }]
|
|
908
|
-
}], panel: [{
|
|
909
|
-
type: ViewChild,
|
|
910
|
-
args: ['panel', { read: ElementRef }]
|
|
911
868
|
}], contentOptions: [{
|
|
912
869
|
type: ContentChildren,
|
|
913
870
|
args: [ThyOption, { descendants: true }]
|
|
914
871
|
}], viewOptions: [{
|
|
915
872
|
type: ViewChildren,
|
|
916
873
|
args: [ThyOption]
|
|
917
|
-
}], contentGroups: [{
|
|
918
|
-
type: ContentChildren,
|
|
919
|
-
args: [ThySelectOptionGroup]
|
|
920
|
-
}], viewGroups: [{
|
|
921
|
-
type: ViewChildren,
|
|
922
|
-
args: [ThySelectOptionGroup]
|
|
923
874
|
}], handleKeydown: [{
|
|
924
875
|
type: HostListener,
|
|
925
876
|
args: ['keydown', ['$event']]
|
|
@@ -932,34 +883,31 @@ const noop = () => { };
|
|
|
932
883
|
* @order 20
|
|
933
884
|
*/
|
|
934
885
|
class ThyNativeSelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
935
|
-
set thySize(value) {
|
|
936
|
-
this._size = value;
|
|
937
|
-
}
|
|
938
886
|
writeValue(obj) {
|
|
939
|
-
if (obj !== this.
|
|
940
|
-
this.
|
|
887
|
+
if (obj !== this.innerValue()) {
|
|
888
|
+
this.innerValue.set(obj);
|
|
941
889
|
}
|
|
942
890
|
}
|
|
943
891
|
setDisabledState(isDisabled) {
|
|
944
|
-
this.
|
|
892
|
+
this.disabled.set(isDisabled);
|
|
945
893
|
}
|
|
946
894
|
constructor() {
|
|
947
895
|
super();
|
|
948
|
-
this.
|
|
949
|
-
|
|
950
|
-
this.
|
|
951
|
-
this._disabled = false;
|
|
952
|
-
this._expandOptions = false;
|
|
896
|
+
this.selectElement = viewChild('select');
|
|
897
|
+
this.innerValue = model(null);
|
|
898
|
+
this.disabled = signal(false);
|
|
953
899
|
this.hostRenderer = useHostRenderer();
|
|
954
|
-
this.
|
|
955
|
-
this.
|
|
900
|
+
this.thySize = input();
|
|
901
|
+
this.name = input();
|
|
902
|
+
this.thyAllowClear = input(false, { transform: coerceBooleanProperty });
|
|
956
903
|
}
|
|
957
904
|
ngModelChange() {
|
|
958
|
-
this.onChangeFn(this.
|
|
905
|
+
this.onChangeFn(this.innerValue());
|
|
959
906
|
this.onTouchedFn();
|
|
960
907
|
}
|
|
961
908
|
ngOnInit() {
|
|
962
|
-
const
|
|
909
|
+
const size = this.thySize();
|
|
910
|
+
const classes = size ? [`thy-select-${size}`] : [];
|
|
963
911
|
this.hostRenderer.updateClass(classes);
|
|
964
912
|
}
|
|
965
913
|
onBlur(event) {
|
|
@@ -969,21 +917,21 @@ class ThyNativeSelect extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
969
917
|
this.onTouchedFn();
|
|
970
918
|
}
|
|
971
919
|
onFocus(event) {
|
|
972
|
-
this.selectElement.nativeElement.focus();
|
|
920
|
+
this.selectElement().nativeElement.focus();
|
|
973
921
|
}
|
|
974
922
|
clearSelectValue(event) {
|
|
975
923
|
event.stopPropagation();
|
|
976
|
-
this.
|
|
977
|
-
this.onChangeFn(this.
|
|
924
|
+
this.innerValue.set('');
|
|
925
|
+
this.onChangeFn(this.innerValue());
|
|
978
926
|
}
|
|
979
927
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyNativeSelect, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
980
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyNativeSelect, isStandalone: true, selector: "thy-native-select", inputs: { thySize: "thySize", name: "name", thyAllowClear:
|
|
928
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", 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: [
|
|
981
929
|
{
|
|
982
930
|
provide: NG_VALUE_ACCESSOR,
|
|
983
931
|
useExisting: forwardRef(() => ThyNativeSelect),
|
|
984
932
|
multi: true
|
|
985
933
|
}
|
|
986
|
-
], viewQueries: [{ propertyName: "selectElement", first: true, predicate: ["select"], descendants: true,
|
|
934
|
+
], 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.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { 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: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] }); }
|
|
987
935
|
}
|
|
988
936
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyNativeSelect, decorators: [{
|
|
989
937
|
type: Component,
|
|
@@ -994,24 +942,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
994
942
|
multi: true
|
|
995
943
|
}
|
|
996
944
|
], imports: [ThyInputDirective, FormsModule, ThyIcon], host: {
|
|
945
|
+
class: 'thy-select',
|
|
997
946
|
'[attr.tabindex]': 'tabIndex',
|
|
998
947
|
'(focus)': 'onFocus($event)',
|
|
999
948
|
'(blur)': 'onBlur($event)'
|
|
1000
|
-
}, template: "<select\n #select\n thyInput\n [tabindex]=\"-1\"\n [thySize]=\"
|
|
1001
|
-
}], ctorParameters: () => []
|
|
1002
|
-
type: ViewChild,
|
|
1003
|
-
args: ['select', { static: true }]
|
|
1004
|
-
}], _isSelect: [{
|
|
1005
|
-
type: HostBinding,
|
|
1006
|
-
args: ['class.thy-select']
|
|
1007
|
-
}], thySize: [{
|
|
1008
|
-
type: Input
|
|
1009
|
-
}], name: [{
|
|
1010
|
-
type: Input
|
|
1011
|
-
}], thyAllowClear: [{
|
|
1012
|
-
type: Input,
|
|
1013
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1014
|
-
}] } });
|
|
949
|
+
}, 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" }]
|
|
950
|
+
}], ctorParameters: () => [] });
|
|
1015
951
|
|
|
1016
952
|
class ThySelectModule {
|
|
1017
953
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|