ngx-tethys 19.1.0-next.1 → 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 +105 -0
- package/arrow-switcher/arrow-switcher.component.d.ts +5 -1
- package/badge/badge.component.d.ts +1 -1
- 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/range-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-menu.component.d.ts +1 -1
- package/dropdown/dropdown.directive.d.ts +4 -3
- package/empty/empty.component.d.ts +2 -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-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-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 +855 -1072
- 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 +9 -11
- 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 +4 -5
- package/fesm2022/ngx-tethys-flexible-text.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-image.mjs +5 -7
- package/fesm2022/ngx-tethys-image.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-radio.mjs +4 -4
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +20 -17
- package/fesm2022/ngx-tethys-resizable.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 -587
- 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-stepper.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-tree-select.mjs +215 -281
- package/fesm2022/ngx-tethys-tree-select.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.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- 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/image/preview/image-preview.component.d.ts +2 -2
- 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/resizable/resizable.directive.d.ts +2 -1
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- 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/stepper/stepper.component.d.ts +1 -1
- 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/tree-select/tree-select.component.d.ts +53 -70
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ViewContainerRef,
|
|
2
|
+
import { input, inject, ViewContainerRef, effect, Directive, ElementRef, NgZone, Renderer2, output, computed, ContentChildren, KeyValueDiffers, TemplateRef, ChangeDetectorRef, NgModule, Input, model, signal, linkedSignal, numberAttribute, viewChild, untracked, ChangeDetectionStrategy, Component, InjectionToken, HostListener, ViewEncapsulation } from '@angular/core';
|
|
3
3
|
import { reqAnimFrame, TabIndexDisabledControlValueAccessorMixin, ThyTranslate, mixinDisabled, MixinBase } from 'ngx-tethys/core';
|
|
4
4
|
import { coerceBooleanProperty, keycodes, isTemplateRef, isUndefinedOrNull, ENTER, SPACE, hasModifierKey } from 'ngx-tethys/util';
|
|
5
5
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
@@ -14,35 +14,34 @@ import * as i1 from '@angular/forms';
|
|
|
14
14
|
import { FormsModule } from '@angular/forms';
|
|
15
15
|
import * as i2 from 'ngx-tethys/grid';
|
|
16
16
|
import { ThyGridModule } from 'ngx-tethys/grid';
|
|
17
|
+
import { ThyTooltipDirective } from 'ngx-tethys/tooltip';
|
|
18
|
+
import { injectLocale } from 'ngx-tethys/i18n';
|
|
19
|
+
import { outputToObservable } from '@angular/core/rxjs-interop';
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* @private
|
|
20
23
|
*/
|
|
21
24
|
class ThyTranscludeDirective {
|
|
22
|
-
set thyTransclude(templateRef) {
|
|
23
|
-
this._ngTransclude = templateRef;
|
|
24
|
-
if (templateRef) {
|
|
25
|
-
this.viewRef.createEmbeddedView(templateRef);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
get thyTransclude() {
|
|
29
|
-
return this._ngTransclude;
|
|
30
|
-
}
|
|
31
25
|
constructor() {
|
|
26
|
+
this.thyTransclude = input();
|
|
32
27
|
const viewRef = inject(ViewContainerRef);
|
|
33
28
|
this.viewRef = viewRef;
|
|
29
|
+
effect(() => {
|
|
30
|
+
const transclude = this.thyTransclude();
|
|
31
|
+
if (transclude) {
|
|
32
|
+
this.viewRef.createEmbeddedView(transclude);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
34
35
|
}
|
|
35
36
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTranscludeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
36
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
37
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyTranscludeDirective, isStandalone: true, selector: "[thyTransclude]", inputs: { thyTransclude: { classPropertyName: "thyTransclude", publicName: "thyTransclude", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
37
38
|
}
|
|
38
39
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTranscludeDirective, decorators: [{
|
|
39
40
|
type: Directive,
|
|
40
41
|
args: [{
|
|
41
42
|
selector: '[thyTransclude]'
|
|
42
43
|
}]
|
|
43
|
-
}], ctorParameters: () => []
|
|
44
|
-
type: Input
|
|
45
|
-
}] } });
|
|
44
|
+
}], ctorParameters: () => [] });
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
47
|
* 自动聚焦指令
|
|
@@ -54,50 +53,43 @@ class ThyAutofocusDirective {
|
|
|
54
53
|
this.ngZone = inject(NgZone);
|
|
55
54
|
// 自动选择,用于只读的 input 输入框,方便复制粘贴
|
|
56
55
|
this._autoSelect = false;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this._autoSelect = value;
|
|
56
|
+
/**
|
|
57
|
+
* 是否自动聚焦
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
this.thyAutofocus = input(false, { transform: coerceBooleanProperty });
|
|
61
|
+
/**
|
|
62
|
+
* 是否自动选择
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
this.thyAutoSelect = input(false, { transform: coerceBooleanProperty });
|
|
66
|
+
effect(() => {
|
|
67
|
+
if (this.thyAutofocus()) {
|
|
68
|
+
// Note: this is being run outside of the Angular zone because `element.focus()` doesn't require
|
|
69
|
+
// running change detection.
|
|
70
|
+
this.ngZone.runOutsideAngular(() =>
|
|
71
|
+
// Note: `element.focus()` causes re-layout and this may lead to frame drop on slower devices.
|
|
72
|
+
// https://gist.github.com/paulirish/5d52fb081b3570c81e3a#setting-focus
|
|
73
|
+
// `setTimeout` is a macrotask and macrotasks are executed within the current rendering frame.
|
|
74
|
+
// Animation tasks are executed within the next rendering frame.
|
|
75
|
+
reqAnimFrame(() => {
|
|
76
|
+
this.elementRef.nativeElement.focus();
|
|
77
|
+
if (this.thyAutoSelect() && this.elementRef.nativeElement.select) {
|
|
78
|
+
this.elementRef.nativeElement.select();
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
85
83
|
}
|
|
86
84
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAutofocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
87
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
85
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyAutofocusDirective, isStandalone: true, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: { thyAutofocus: { classPropertyName: "thyAutofocus", publicName: "thyAutofocus", isSignal: true, isRequired: false, transformFunction: null }, thyAutoSelect: { classPropertyName: "thyAutoSelect", publicName: "thyAutoSelect", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
88
86
|
}
|
|
89
87
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAutofocusDirective, decorators: [{
|
|
90
88
|
type: Directive,
|
|
91
89
|
args: [{
|
|
92
90
|
selector: 'input[thyAutofocus],textarea[thyAutofocus]'
|
|
93
91
|
}]
|
|
94
|
-
}],
|
|
95
|
-
type: Input,
|
|
96
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
97
|
-
}], thyAutoSelect: [{
|
|
98
|
-
type: Input,
|
|
99
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
100
|
-
}] } });
|
|
92
|
+
}], ctorParameters: () => [] });
|
|
101
93
|
|
|
102
94
|
/**
|
|
103
95
|
* 与 (keydown.enter) 区别是支持组合键,当按 Ctrl + Enter 或者 Command + Enter 也会触发
|
|
@@ -108,7 +100,7 @@ class ThyEnterDirective {
|
|
|
108
100
|
this.ngZone = inject(NgZone);
|
|
109
101
|
this.elementRef = inject(ElementRef);
|
|
110
102
|
this.renderer = inject(Renderer2);
|
|
111
|
-
this.thyEnter =
|
|
103
|
+
this.thyEnter = output();
|
|
112
104
|
this.onKeydown = (event) => {
|
|
113
105
|
const keyCode = event.which || event.keyCode;
|
|
114
106
|
if (keyCode === keycodes.ENTER) {
|
|
@@ -134,9 +126,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
134
126
|
args: [{
|
|
135
127
|
selector: '[thyEnter]'
|
|
136
128
|
}]
|
|
137
|
-
}]
|
|
138
|
-
type: Output
|
|
139
|
-
}] } });
|
|
129
|
+
}] });
|
|
140
130
|
|
|
141
131
|
/**
|
|
142
132
|
* @name thyCtrlEnter
|
|
@@ -146,7 +136,7 @@ class ThyCtrlEnterDirective {
|
|
|
146
136
|
this.ngZone = inject(NgZone);
|
|
147
137
|
this.elementRef = inject(ElementRef);
|
|
148
138
|
this.renderer = inject(Renderer2);
|
|
149
|
-
this.thyCtrlEnter =
|
|
139
|
+
this.thyCtrlEnter = output();
|
|
150
140
|
this.onKeydown = (event) => {
|
|
151
141
|
const keyCode = event.which || event.keyCode;
|
|
152
142
|
if ((event.ctrlKey || event.metaKey) && keyCode === keycodes.ENTER) {
|
|
@@ -173,97 +163,91 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
173
163
|
args: [{
|
|
174
164
|
selector: '[thyCtrlEnter]'
|
|
175
165
|
}]
|
|
176
|
-
}]
|
|
177
|
-
type: Output
|
|
178
|
-
}] } });
|
|
166
|
+
}] });
|
|
179
167
|
|
|
180
168
|
/**
|
|
181
169
|
* @name thyShow
|
|
182
170
|
*/
|
|
183
171
|
class ThyShowDirective {
|
|
184
|
-
constructor() {
|
|
185
|
-
this.elementRef = inject(ElementRef);
|
|
186
|
-
this.renderer = inject(Renderer2);
|
|
187
|
-
this.ngZone = inject(NgZone);
|
|
188
|
-
this.thyShowChange = new EventEmitter();
|
|
189
|
-
this.hostRenderer = useHostRenderer();
|
|
190
|
-
}
|
|
191
172
|
unListenDocument() {
|
|
192
173
|
if (this.unListenEvent) {
|
|
193
174
|
this.unListenEvent();
|
|
194
175
|
this.unListenEvent = null;
|
|
195
176
|
}
|
|
196
177
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
178
|
+
constructor() {
|
|
179
|
+
this.elementRef = inject(ElementRef);
|
|
180
|
+
this.renderer = inject(Renderer2);
|
|
181
|
+
this.ngZone = inject(NgZone);
|
|
182
|
+
this.thyShowChange = output();
|
|
183
|
+
this.hostRenderer = useHostRenderer();
|
|
184
|
+
this.thyShow = input(false, { transform: coerceBooleanProperty });
|
|
185
|
+
effect(() => {
|
|
186
|
+
if (this.thyShow()) {
|
|
187
|
+
this.hostRenderer.setStyle('display', 'block');
|
|
188
|
+
this.ngZone.runOutsideAngular(() => setTimeout(() => {
|
|
189
|
+
this.unListenEvent = this.renderer.listen('document', 'click', event => {
|
|
190
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
204
191
|
this.ngZone.run(() => this.thyShowChange.emit(false));
|
|
192
|
+
this.unListenDocument();
|
|
205
193
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
194
|
+
});
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
this.hostRenderer.setStyle('display', 'none');
|
|
199
|
+
this.unListenDocument();
|
|
200
|
+
}
|
|
201
|
+
});
|
|
215
202
|
}
|
|
216
203
|
ngOnDestroy() {
|
|
217
204
|
this.unListenDocument();
|
|
218
205
|
}
|
|
219
206
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyShowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
220
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
207
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyShowDirective, isStandalone: true, selector: "[thyShow]", inputs: { thyShow: { classPropertyName: "thyShow", publicName: "thyShow", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyShowChange: "thyShowChange" }, ngImport: i0 }); }
|
|
221
208
|
}
|
|
222
209
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyShowDirective, decorators: [{
|
|
223
210
|
type: Directive,
|
|
224
211
|
args: [{
|
|
225
212
|
selector: '[thyShow]'
|
|
226
213
|
}]
|
|
227
|
-
}],
|
|
228
|
-
type: Output
|
|
229
|
-
}], thyShow: [{
|
|
230
|
-
type: Input,
|
|
231
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
232
|
-
}] } });
|
|
214
|
+
}], ctorParameters: () => [] });
|
|
233
215
|
|
|
234
216
|
/**
|
|
235
217
|
* 阻止事件冒泡
|
|
236
218
|
* @name thyStopPropagation
|
|
237
219
|
*/
|
|
238
220
|
class ThyStopPropagationDirective {
|
|
239
|
-
set thyStopPropagation(value) {
|
|
240
|
-
if (value === false || value === 'false') {
|
|
241
|
-
this._shouldStopPropagation = false;
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
this._shouldStopPropagation = true;
|
|
245
|
-
if (!value || value === true || value === 'true') {
|
|
246
|
-
this._eventName = 'click';
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
this._eventName = value;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
this._changes$.next();
|
|
253
|
-
}
|
|
254
221
|
constructor() {
|
|
255
|
-
this.
|
|
256
|
-
this.
|
|
222
|
+
this.thyStopPropagation = input(true);
|
|
223
|
+
this._eventName = computed(() => {
|
|
224
|
+
const stopPropagation = this.thyStopPropagation();
|
|
225
|
+
if (stopPropagation !== false) {
|
|
226
|
+
if (!stopPropagation || stopPropagation === true || stopPropagation === 'true') {
|
|
227
|
+
return 'click';
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
return stopPropagation;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
this._shouldStopPropagation = computed(() => {
|
|
235
|
+
const stopPropagation = this.thyStopPropagation();
|
|
236
|
+
return stopPropagation === false || stopPropagation === 'false' ? false : true;
|
|
237
|
+
});
|
|
257
238
|
this._changes$ = new Subject();
|
|
258
239
|
this._destroy$ = new Subject();
|
|
259
240
|
const _host = inject(ElementRef);
|
|
260
241
|
const _ngZone = inject(NgZone);
|
|
242
|
+
effect(() => {
|
|
243
|
+
this._changes$.next(this.thyStopPropagation());
|
|
244
|
+
});
|
|
261
245
|
this._changes$
|
|
262
246
|
.pipe(
|
|
263
247
|
// Note: we start the stream immediately since the `thyStopPropagation` setter may never be reached.
|
|
264
|
-
startWith(null), switchMap(() => new Observable(subscriber => _ngZone.runOutsideAngular(() => fromEvent(_host.nativeElement, this._eventName).subscribe(subscriber)))), takeUntil(this._destroy$))
|
|
248
|
+
startWith(null), switchMap(() => new Observable(subscriber => _ngZone.runOutsideAngular(() => fromEvent(_host.nativeElement, this._eventName()).subscribe(subscriber)))), takeUntil(this._destroy$))
|
|
265
249
|
.subscribe(event => {
|
|
266
|
-
if (this._shouldStopPropagation) {
|
|
250
|
+
if (this._shouldStopPropagation()) {
|
|
267
251
|
event.stopPropagation();
|
|
268
252
|
}
|
|
269
253
|
});
|
|
@@ -272,16 +256,14 @@ class ThyStopPropagationDirective {
|
|
|
272
256
|
this._destroy$.next();
|
|
273
257
|
}
|
|
274
258
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStopPropagationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
275
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
259
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyStopPropagationDirective, isStandalone: true, selector: "[thyStopPropagation]", inputs: { thyStopPropagation: { classPropertyName: "thyStopPropagation", publicName: "thyStopPropagation", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
276
260
|
}
|
|
277
261
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStopPropagationDirective, decorators: [{
|
|
278
262
|
type: Directive,
|
|
279
263
|
args: [{
|
|
280
264
|
selector: '[thyStopPropagation]'
|
|
281
265
|
}]
|
|
282
|
-
}], ctorParameters: () => []
|
|
283
|
-
type: Input
|
|
284
|
-
}] } });
|
|
266
|
+
}], ctorParameters: () => [] });
|
|
285
267
|
|
|
286
268
|
/**
|
|
287
269
|
* @name thyContextMenu
|
|
@@ -291,7 +273,7 @@ class ThyContextMenuDirective {
|
|
|
291
273
|
this.ngZone = inject(NgZone);
|
|
292
274
|
this.elementRef = inject(ElementRef);
|
|
293
275
|
this.renderer = inject(Renderer2);
|
|
294
|
-
this.thyContextMenu =
|
|
276
|
+
this.thyContextMenu = output();
|
|
295
277
|
this.rightClick = (event) => {
|
|
296
278
|
event.preventDefault();
|
|
297
279
|
this.ngZone.run(() => {
|
|
@@ -315,9 +297,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
315
297
|
args: [{
|
|
316
298
|
selector: '[thyContextMenu]'
|
|
317
299
|
}]
|
|
318
|
-
}]
|
|
319
|
-
type: Output
|
|
320
|
-
}] } });
|
|
300
|
+
}] });
|
|
321
301
|
|
|
322
302
|
const passiveEventListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
323
303
|
/**
|
|
@@ -328,11 +308,10 @@ class ThyScrollDirective {
|
|
|
328
308
|
this.elementRef = inject(ElementRef);
|
|
329
309
|
this.ngZone = inject(NgZone);
|
|
330
310
|
this._destroyed = new Subject();
|
|
331
|
-
this._enable = true;
|
|
332
|
-
this._initialled = false;
|
|
333
311
|
this._elementScrolled = new Observable((observer) => this.ngZone.runOutsideAngular(() => fromEvent(this.elementRef.nativeElement, 'scroll', passiveEventListenerOptions)
|
|
334
312
|
.pipe(takeUntil(this._destroyed))
|
|
335
313
|
.subscribe(observer)));
|
|
314
|
+
this.thyEnable = input(true, { transform: coerceBooleanProperty });
|
|
336
315
|
/**
|
|
337
316
|
* @description
|
|
338
317
|
*
|
|
@@ -352,12 +331,10 @@ class ThyScrollDirective {
|
|
|
352
331
|
* }
|
|
353
332
|
* ```
|
|
354
333
|
*/
|
|
355
|
-
this.thyOnScrolled =
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
if (this._initialled) {
|
|
360
|
-
if (this._enable && this._subscription === null) {
|
|
334
|
+
this.thyOnScrolled = output();
|
|
335
|
+
effect(() => {
|
|
336
|
+
const thyEnable = this.thyEnable();
|
|
337
|
+
if (thyEnable && !this._subscription) {
|
|
361
338
|
this._subscription = this._elementScrolled.subscribe(() => this.thyOnScrolled.emit(this.elementRef));
|
|
362
339
|
}
|
|
363
340
|
else {
|
|
@@ -366,14 +343,9 @@ class ThyScrollDirective {
|
|
|
366
343
|
this._subscription = null;
|
|
367
344
|
}
|
|
368
345
|
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
ngOnInit() {
|
|
372
|
-
if (this._enable) {
|
|
373
|
-
this._subscription = this._elementScrolled.subscribe(() => this.thyOnScrolled.emit(this.elementRef));
|
|
374
|
-
}
|
|
375
|
-
this._initialled = true;
|
|
346
|
+
});
|
|
376
347
|
}
|
|
348
|
+
ngOnInit() { }
|
|
377
349
|
ngOnDestroy() {
|
|
378
350
|
this._destroyed.next();
|
|
379
351
|
this._destroyed.complete();
|
|
@@ -382,19 +354,14 @@ class ThyScrollDirective {
|
|
|
382
354
|
return this.elementRef;
|
|
383
355
|
}
|
|
384
356
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
385
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
357
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyScrollDirective, isStandalone: true, selector: "[thyScroll]", inputs: { thyEnable: { classPropertyName: "thyEnable", publicName: "thyEnable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyOnScrolled: "thyOnScrolled" }, ngImport: i0 }); }
|
|
386
358
|
}
|
|
387
359
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyScrollDirective, decorators: [{
|
|
388
360
|
type: Directive,
|
|
389
361
|
args: [{
|
|
390
362
|
selector: '[thyScroll]'
|
|
391
363
|
}]
|
|
392
|
-
}],
|
|
393
|
-
type: Input,
|
|
394
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
395
|
-
}], thyOnScrolled: [{
|
|
396
|
-
type: Output
|
|
397
|
-
}] } });
|
|
364
|
+
}], ctorParameters: () => [] });
|
|
398
365
|
|
|
399
366
|
/**
|
|
400
367
|
* @private
|
|
@@ -448,23 +415,26 @@ class ThyStringOrTemplateOutletDirective {
|
|
|
448
415
|
constructor() {
|
|
449
416
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
450
417
|
this.renderer = inject(Renderer2);
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
418
|
+
this.thyStringOrTemplateOutletContext = input();
|
|
419
|
+
this.thyStringOrTemplateOutlet = input();
|
|
420
|
+
effect(() => {
|
|
454
421
|
this.updateView();
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
this.viewRef
|
|
458
|
-
|
|
422
|
+
});
|
|
423
|
+
effect(() => {
|
|
424
|
+
if (this.viewRef && this.thyStringOrTemplateOutletContext()) {
|
|
425
|
+
this.viewRef.context = this.thyStringOrTemplateOutletContext();
|
|
426
|
+
}
|
|
427
|
+
});
|
|
459
428
|
}
|
|
460
429
|
updateView() {
|
|
430
|
+
const thyStringOrTemplateOutlet = this.thyStringOrTemplateOutlet();
|
|
461
431
|
this.clear();
|
|
462
|
-
if (
|
|
463
|
-
if (isTemplateRef(
|
|
464
|
-
this.viewRef = this.viewContainerRef.createEmbeddedView(
|
|
432
|
+
if (thyStringOrTemplateOutlet) {
|
|
433
|
+
if (isTemplateRef(thyStringOrTemplateOutlet)) {
|
|
434
|
+
this.viewRef = this.viewContainerRef.createEmbeddedView(thyStringOrTemplateOutlet, this.thyStringOrTemplateOutletContext());
|
|
465
435
|
}
|
|
466
436
|
else {
|
|
467
|
-
this.textNode = this.renderer.createText(
|
|
437
|
+
this.textNode = this.renderer.createText(thyStringOrTemplateOutlet + '');
|
|
468
438
|
const element = this.viewContainerRef.element.nativeElement;
|
|
469
439
|
this.renderer.insertBefore(element.parentNode, this.textNode, element);
|
|
470
440
|
}
|
|
@@ -480,7 +450,7 @@ class ThyStringOrTemplateOutletDirective {
|
|
|
480
450
|
}
|
|
481
451
|
}
|
|
482
452
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStringOrTemplateOutletDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
483
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
453
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyStringOrTemplateOutletDirective, isStandalone: true, selector: "[thyStringOrTemplateOutlet]", inputs: { thyStringOrTemplateOutletContext: { classPropertyName: "thyStringOrTemplateOutletContext", publicName: "thyStringOrTemplateOutletContext", isSignal: true, isRequired: false, transformFunction: null }, thyStringOrTemplateOutlet: { classPropertyName: "thyStringOrTemplateOutlet", publicName: "thyStringOrTemplateOutlet", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["thyStringOrTemplateOutlet"], ngImport: i0 }); }
|
|
484
454
|
}
|
|
485
455
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStringOrTemplateOutletDirective, decorators: [{
|
|
486
456
|
type: Directive,
|
|
@@ -488,11 +458,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
488
458
|
selector: '[thyStringOrTemplateOutlet]',
|
|
489
459
|
exportAs: 'thyStringOrTemplateOutlet'
|
|
490
460
|
}]
|
|
491
|
-
}],
|
|
492
|
-
type: Input
|
|
493
|
-
}], thyStringOrTemplateOutlet: [{
|
|
494
|
-
type: Input
|
|
495
|
-
}] } });
|
|
461
|
+
}], ctorParameters: () => [] });
|
|
496
462
|
|
|
497
463
|
function hasInput(componentRef, inputKey) {
|
|
498
464
|
return componentRef['_tNode'].inputs?.[inputKey];
|
|
@@ -509,37 +475,43 @@ class ThyViewOutletDirective {
|
|
|
509
475
|
/**
|
|
510
476
|
* 组件或者模板 TemplateRef
|
|
511
477
|
*/
|
|
512
|
-
this.thyViewOutlet = null;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
478
|
+
this.thyViewOutlet = input(null);
|
|
479
|
+
/**
|
|
480
|
+
* 组件和模板上下文传递数据
|
|
481
|
+
*/
|
|
482
|
+
this.thyViewOutletContext = input();
|
|
483
|
+
effect(() => {
|
|
484
|
+
const thyViewOutlet = this.thyViewOutlet();
|
|
485
|
+
const { viewContainerRef: viewContainerRef } = this;
|
|
517
486
|
viewContainerRef.clear();
|
|
518
487
|
this.componentRef = undefined;
|
|
519
488
|
this.embeddedViewRef = undefined;
|
|
520
|
-
if (
|
|
521
|
-
if (
|
|
522
|
-
this.embeddedViewRef = viewContainerRef.createEmbeddedView(
|
|
489
|
+
if (thyViewOutlet) {
|
|
490
|
+
if (thyViewOutlet instanceof TemplateRef) {
|
|
491
|
+
this.embeddedViewRef = viewContainerRef.createEmbeddedView(thyViewOutlet, this.thyViewOutletContext());
|
|
523
492
|
}
|
|
524
493
|
else {
|
|
525
|
-
this.componentRef = viewContainerRef.createComponent(
|
|
494
|
+
this.componentRef = viewContainerRef.createComponent(thyViewOutlet, {
|
|
526
495
|
index: viewContainerRef.length
|
|
527
496
|
});
|
|
528
497
|
}
|
|
529
498
|
}
|
|
530
|
-
}
|
|
531
|
-
|
|
499
|
+
});
|
|
500
|
+
effect(() => {
|
|
501
|
+
const thyViewOutletContext = this.thyViewOutletContext();
|
|
532
502
|
let updatedKeys = [];
|
|
533
|
-
if (
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
503
|
+
if (thyViewOutletContext) {
|
|
504
|
+
if (!this.keyValueDiffer) {
|
|
505
|
+
this.keyValueDiffer = this.keyValueDiffers.find(this.thyViewOutletContext()).create();
|
|
506
|
+
this.keyValueDiffer.diff(thyViewOutletContext);
|
|
507
|
+
updatedKeys = Object.keys(thyViewOutletContext);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
const diffChanges = this.keyValueDiffer.diff(this.thyViewOutletContext());
|
|
511
|
+
diffChanges?.forEachChangedItem(item => {
|
|
512
|
+
updatedKeys.push(item.key);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
543
515
|
}
|
|
544
516
|
if (this.componentRef) {
|
|
545
517
|
this.updateContext(this.componentRef.instance, updatedKeys);
|
|
@@ -549,32 +521,28 @@ class ThyViewOutletDirective {
|
|
|
549
521
|
this.updateContext(this.embeddedViewRef.context, updatedKeys);
|
|
550
522
|
this.embeddedViewRef.markForCheck();
|
|
551
523
|
}
|
|
552
|
-
}
|
|
524
|
+
});
|
|
553
525
|
}
|
|
554
526
|
updateContext(context, updatedKeys) {
|
|
555
527
|
updatedKeys.forEach(key => {
|
|
556
528
|
// 兼容组件输入属性没有通过 @Input,设置了 @Input 采用 setInput,否则直接赋值,setInput 会触发 Angular 组件的 onChanges
|
|
557
529
|
if (this.componentRef && hasInput(this.componentRef, key)) {
|
|
558
|
-
this.componentRef.setInput(key, this.thyViewOutletContext[key]);
|
|
530
|
+
this.componentRef.setInput(key, this.thyViewOutletContext()[key]);
|
|
559
531
|
}
|
|
560
532
|
else {
|
|
561
|
-
context[key] = this.thyViewOutletContext[key];
|
|
533
|
+
context[key] = this.thyViewOutletContext()[key];
|
|
562
534
|
}
|
|
563
535
|
});
|
|
564
536
|
}
|
|
565
537
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyViewOutletDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
566
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
538
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyViewOutletDirective, isStandalone: true, selector: "[thyViewOutlet]", inputs: { thyViewOutlet: { classPropertyName: "thyViewOutlet", publicName: "thyViewOutlet", isSignal: true, isRequired: false, transformFunction: null }, thyViewOutletContext: { classPropertyName: "thyViewOutletContext", publicName: "thyViewOutletContext", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
567
539
|
}
|
|
568
540
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyViewOutletDirective, decorators: [{
|
|
569
541
|
type: Directive,
|
|
570
542
|
args: [{
|
|
571
543
|
selector: '[thyViewOutlet]'
|
|
572
544
|
}]
|
|
573
|
-
}],
|
|
574
|
-
type: Input
|
|
575
|
-
}], thyViewOutletContext: [{
|
|
576
|
-
type: Input
|
|
577
|
-
}] } });
|
|
545
|
+
}], ctorParameters: () => [] });
|
|
578
546
|
|
|
579
547
|
class ThySharedModule {
|
|
580
548
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -639,33 +607,6 @@ const noop = () => { };
|
|
|
639
607
|
* @private
|
|
640
608
|
*/
|
|
641
609
|
class ThyFormCheckBaseComponent extends TabIndexDisabledControlValueAccessorMixin {
|
|
642
|
-
get _isNoText() {
|
|
643
|
-
return this._isFormCheckInline && !this._labelText;
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* 是否同一行展示
|
|
647
|
-
* @default false
|
|
648
|
-
*/
|
|
649
|
-
set thyInline(value) {
|
|
650
|
-
this._isFormCheckInline = value;
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Label 展示文本
|
|
654
|
-
*/
|
|
655
|
-
set thyLabelText(value) {
|
|
656
|
-
this._labelText = value;
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* Label 文本多语言 key
|
|
660
|
-
*/
|
|
661
|
-
set thyLabelTextTranslateKey(value) {
|
|
662
|
-
if (value) {
|
|
663
|
-
this._labelText = this.thyTranslate.instant(value);
|
|
664
|
-
}
|
|
665
|
-
else {
|
|
666
|
-
this._labelText = '';
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
610
|
/**
|
|
670
611
|
* 是否禁用
|
|
671
612
|
* @default false
|
|
@@ -709,8 +650,28 @@ class ThyFormCheckBaseComponent extends TabIndexDisabledControlValueAccessorMixi
|
|
|
709
650
|
this.onTouchedCallback = noop;
|
|
710
651
|
this.onChangeCallback = noop;
|
|
711
652
|
this._isFormCheck = true;
|
|
712
|
-
this._isFormCheckInline = false;
|
|
713
653
|
this._isChecked = false;
|
|
654
|
+
/**
|
|
655
|
+
* 是否同一行展示
|
|
656
|
+
* @default false
|
|
657
|
+
*/
|
|
658
|
+
this.thyInline = input(false, { transform: coerceBooleanProperty });
|
|
659
|
+
/**
|
|
660
|
+
* Label 展示文本
|
|
661
|
+
*/
|
|
662
|
+
this.thyLabelText = input();
|
|
663
|
+
/**
|
|
664
|
+
* Label 文本多语言 key
|
|
665
|
+
*/
|
|
666
|
+
this.thyLabelTextTranslateKey = input();
|
|
667
|
+
this._labelText = computed(() => {
|
|
668
|
+
const labelTextTranslateKey = this.thyLabelTextTranslateKey();
|
|
669
|
+
const labelText = this.thyLabelText();
|
|
670
|
+
return labelTextTranslateKey ? this.thyTranslate.instant(labelTextTranslateKey) : labelText || '';
|
|
671
|
+
});
|
|
672
|
+
this._isNoText = computed(() => {
|
|
673
|
+
return this.thyInline() && !this._labelText();
|
|
674
|
+
});
|
|
714
675
|
this.disabled = false;
|
|
715
676
|
}
|
|
716
677
|
change() {
|
|
@@ -722,30 +683,19 @@ class ThyFormCheckBaseComponent extends TabIndexDisabledControlValueAccessorMixi
|
|
|
722
683
|
}
|
|
723
684
|
}
|
|
724
685
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormCheckBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
725
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
686
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyFormCheckBaseComponent, isStandalone: true, inputs: { thyInline: { classPropertyName: "thyInline", publicName: "thyInline", isSignal: true, isRequired: false, transformFunction: null }, thyLabelText: { classPropertyName: "thyLabelText", publicName: "thyLabelText", isSignal: true, isRequired: false, transformFunction: null }, thyLabelTextTranslateKey: { classPropertyName: "thyLabelTextTranslateKey", publicName: "thyLabelTextTranslateKey", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: false, isRequired: false, transformFunction: coerceBooleanProperty } }, host: { properties: { "class.form-check": "_isFormCheck", "class.form-check-inline": "thyInline()", "class.form-check-checked": "_isChecked", "class.form-check-inline-no-label-text": "_isNoText()" } }, usesInheritance: true, ngImport: i0 }); }
|
|
726
687
|
}
|
|
727
688
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormCheckBaseComponent, decorators: [{
|
|
728
|
-
type: Directive
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}], _isNoText: [{
|
|
739
|
-
type: HostBinding,
|
|
740
|
-
args: ['class.form-check-inline-no-label-text']
|
|
741
|
-
}], thyInline: [{
|
|
742
|
-
type: Input,
|
|
743
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
744
|
-
}], thyLabelText: [{
|
|
745
|
-
type: Input
|
|
746
|
-
}], thyLabelTextTranslateKey: [{
|
|
747
|
-
type: Input
|
|
748
|
-
}], thyDisabled: [{
|
|
689
|
+
type: Directive,
|
|
690
|
+
args: [{
|
|
691
|
+
host: {
|
|
692
|
+
'[class.form-check]': '_isFormCheck',
|
|
693
|
+
'[class.form-check-inline]': 'thyInline()',
|
|
694
|
+
'[class.form-check-checked]': '_isChecked',
|
|
695
|
+
'[class.form-check-inline-no-label-text]': '_isNoText()'
|
|
696
|
+
}
|
|
697
|
+
}]
|
|
698
|
+
}], ctorParameters: () => [], propDecorators: { thyDisabled: [{
|
|
749
699
|
type: Input,
|
|
750
700
|
args: [{ transform: coerceBooleanProperty }]
|
|
751
701
|
}] } });
|
|
@@ -756,206 +706,205 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
756
706
|
class ThySelectControl {
|
|
757
707
|
constructor() {
|
|
758
708
|
this.renderer = inject(Renderer2);
|
|
759
|
-
this.inputValue = '';
|
|
760
|
-
this.isComposing = false;
|
|
761
|
-
this.
|
|
762
|
-
this.isMultiple = false;
|
|
763
|
-
this.showSearch = false;
|
|
764
|
-
this.disabled = false;
|
|
709
|
+
this.inputValue = model('');
|
|
710
|
+
this.isComposing = signal(false);
|
|
711
|
+
this.isFirstPanelOpenedChange = true;
|
|
765
712
|
this.hostRenderer = useHostRenderer();
|
|
766
|
-
this.
|
|
767
|
-
this.
|
|
768
|
-
this.
|
|
769
|
-
this.
|
|
770
|
-
this.
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
this.
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
this.inputElement.nativeElement.focus();
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
if (!this.panelOpened && this.thyShowSearch) {
|
|
787
|
-
new Promise(resolve => setTimeout(resolve, 100)).then(() => {
|
|
788
|
-
this.inputValue = '';
|
|
789
|
-
this.updateWidth();
|
|
790
|
-
this.thyOnSearch.emit(this.inputValue);
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
|
-
this.setSelectControlClass();
|
|
794
|
-
}
|
|
795
|
-
get thyIsMultiple() {
|
|
796
|
-
return this.isMultiple;
|
|
797
|
-
}
|
|
798
|
-
set thyIsMultiple(value) {
|
|
799
|
-
this.isMultiple = value;
|
|
800
|
-
this.setSelectControlClass();
|
|
801
|
-
}
|
|
802
|
-
get thyShowSearch() {
|
|
803
|
-
return this.showSearch;
|
|
804
|
-
}
|
|
805
|
-
set thyShowSearch(value) {
|
|
806
|
-
this.showSearch = value;
|
|
807
|
-
this.setSelectControlClass();
|
|
808
|
-
}
|
|
809
|
-
get thySelectedOptions() {
|
|
810
|
-
return this.selectedOptions;
|
|
811
|
-
}
|
|
812
|
-
set thySelectedOptions(value) {
|
|
813
|
-
let sameValue = false;
|
|
814
|
-
const oldValue = this.selectedOptions;
|
|
815
|
-
if (this.isMultiple) {
|
|
816
|
-
if (oldValue instanceof Array && value instanceof Array && oldValue.length === value.length) {
|
|
817
|
-
sameValue = value.every((option, index) => option.thyValue === oldValue[index].thyValue);
|
|
713
|
+
this.thyPanelOpened = input(false, { transform: coerceBooleanProperty });
|
|
714
|
+
this.thyIsMultiple = input(false, { transform: coerceBooleanProperty });
|
|
715
|
+
this.thyShowSearch = input(false, { transform: coerceBooleanProperty });
|
|
716
|
+
this.thySelectedOptions = input();
|
|
717
|
+
this.previousSelectedOptions = linkedSignal({
|
|
718
|
+
source: () => this.thySelectedOptions(),
|
|
719
|
+
computation: (source, previous) => previous?.source
|
|
720
|
+
});
|
|
721
|
+
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
722
|
+
this.customDisplayTemplate = input(undefined);
|
|
723
|
+
this.thyAllowClear = input(false, { transform: coerceBooleanProperty });
|
|
724
|
+
this.thyPlaceholder = input('');
|
|
725
|
+
this.thySize = input();
|
|
726
|
+
this.tagSize = computed(() => {
|
|
727
|
+
const value = this.thySize();
|
|
728
|
+
if (value === 'xs' || value === 'sm') {
|
|
729
|
+
return 'sm';
|
|
818
730
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
if (oldValue && value) {
|
|
822
|
-
sameValue = oldValue.thyValue === value.thyValue;
|
|
731
|
+
else if (value === 'lg') {
|
|
732
|
+
return 'lg';
|
|
823
733
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (this.panelOpened && this.thyShowSearch) {
|
|
827
|
-
if (!sameValue) {
|
|
828
|
-
Promise.resolve(null).then(() => {
|
|
829
|
-
this.inputValue = '';
|
|
830
|
-
this.updateWidth();
|
|
831
|
-
});
|
|
734
|
+
else {
|
|
735
|
+
return 'md';
|
|
832
736
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
737
|
+
});
|
|
738
|
+
this.thyMaxTagCount = input(0, { transform: numberAttribute });
|
|
739
|
+
this.thyBorderless = input(false, { transform: coerceBooleanProperty });
|
|
740
|
+
this.thyPreset = input('');
|
|
741
|
+
this.thyOnSearch = output();
|
|
742
|
+
this.thyOnRemove = output();
|
|
743
|
+
this.thyOnClear = output();
|
|
744
|
+
this.thyOnBlur = output();
|
|
745
|
+
this.inputElement = viewChild('inputElement');
|
|
746
|
+
this.locale = injectLocale('shared');
|
|
747
|
+
this.isSelectedValue = computed(() => {
|
|
748
|
+
return ((!this.thyIsMultiple() && !isUndefinedOrNull(this.thySelectedOptions())) ||
|
|
749
|
+
(this.thyIsMultiple() && this.thySelectedOptions().length > 0));
|
|
750
|
+
});
|
|
751
|
+
this.showClearIcon = computed(() => {
|
|
752
|
+
return this.thyAllowClear() && this.isSelectedValue();
|
|
753
|
+
});
|
|
754
|
+
this.maxSelectedTags = computed(() => {
|
|
755
|
+
const selectedOptions = this.thySelectedOptions();
|
|
756
|
+
if (this.thyMaxTagCount() > 0 && selectedOptions instanceof Array && selectedOptions.length > this.thyMaxTagCount()) {
|
|
757
|
+
return selectedOptions.slice(0, this.thyMaxTagCount() - 1);
|
|
758
|
+
}
|
|
759
|
+
return selectedOptions;
|
|
760
|
+
});
|
|
761
|
+
this.collapsedSelectedTags = computed(() => {
|
|
762
|
+
const selectedOptions = this.thySelectedOptions();
|
|
763
|
+
const maxTagCount = this.thyMaxTagCount();
|
|
764
|
+
if (maxTagCount && selectedOptions instanceof Array && selectedOptions.length > maxTagCount) {
|
|
765
|
+
return selectedOptions.slice(maxTagCount - 1, selectedOptions.length);
|
|
766
|
+
}
|
|
767
|
+
return [];
|
|
768
|
+
});
|
|
769
|
+
this.selectedValueStyle = computed(() => {
|
|
770
|
+
let showSelectedValue = false;
|
|
771
|
+
if (this.thyShowSearch()) {
|
|
772
|
+
if (this.thyPanelOpened()) {
|
|
773
|
+
showSelectedValue = !(this.isComposing() || this.inputValue());
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
showSelectedValue = true;
|
|
837
777
|
}
|
|
838
|
-
}, 200);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
get thyDisabled() {
|
|
842
|
-
return this.disabled;
|
|
843
|
-
}
|
|
844
|
-
set thyDisabled(value) {
|
|
845
|
-
this.disabled = value;
|
|
846
|
-
this.setSelectControlClass();
|
|
847
|
-
}
|
|
848
|
-
get thySize() {
|
|
849
|
-
return this.size;
|
|
850
|
-
}
|
|
851
|
-
set thySize(value) {
|
|
852
|
-
this.size = value;
|
|
853
|
-
this.setSelectControlClass();
|
|
854
|
-
if (value === 'xs' || value === 'sm') {
|
|
855
|
-
this.tagSize = 'sm';
|
|
856
|
-
}
|
|
857
|
-
else if (value === 'lg') {
|
|
858
|
-
this.tagSize = 'lg';
|
|
859
|
-
}
|
|
860
|
-
else {
|
|
861
|
-
this.tagSize = 'md';
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
get selectedValueStyle() {
|
|
865
|
-
let showSelectedValue = false;
|
|
866
|
-
if (this.showSearch) {
|
|
867
|
-
if (this.panelOpened) {
|
|
868
|
-
showSelectedValue = !(this.isComposing || this.inputValue);
|
|
869
778
|
}
|
|
870
779
|
else {
|
|
871
780
|
showSelectedValue = true;
|
|
872
781
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
782
|
+
return { display: showSelectedValue ? 'flex' : 'none' };
|
|
783
|
+
});
|
|
784
|
+
this.placeholderStyle = computed(() => {
|
|
785
|
+
let placeholder = true;
|
|
786
|
+
if (this.isSelectedValue()) {
|
|
787
|
+
placeholder = false;
|
|
788
|
+
}
|
|
789
|
+
if (!this.thyPlaceholder()) {
|
|
790
|
+
placeholder = false;
|
|
791
|
+
}
|
|
792
|
+
if (this.isComposing() || this.inputValue()) {
|
|
793
|
+
placeholder = false;
|
|
794
|
+
}
|
|
795
|
+
return { display: placeholder ? 'block' : 'none' };
|
|
796
|
+
});
|
|
797
|
+
effect(() => {
|
|
798
|
+
const panelOpened = this.thyPanelOpened();
|
|
799
|
+
if (this.isFirstPanelOpenedChange) {
|
|
800
|
+
this.isFirstPanelOpenedChange = false;
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
if (panelOpened) {
|
|
804
|
+
untracked(() => {
|
|
805
|
+
if (this.thyShowSearch()) {
|
|
806
|
+
Promise.resolve(null).then(() => {
|
|
807
|
+
this.inputElement()?.nativeElement.focus();
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
else {
|
|
813
|
+
untracked(() => {
|
|
814
|
+
if (this.thyShowSearch()) {
|
|
815
|
+
new Promise(resolve => setTimeout(resolve, 100)).then(() => {
|
|
816
|
+
this.inputValue.set('');
|
|
817
|
+
this.updateWidth();
|
|
818
|
+
this.thyOnSearch.emit(this.inputValue());
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
effect(() => {
|
|
825
|
+
this.setSelectControlClass();
|
|
826
|
+
});
|
|
827
|
+
effect(() => {
|
|
828
|
+
const oldValue = this.previousSelectedOptions();
|
|
829
|
+
const value = this.thySelectedOptions();
|
|
830
|
+
if (value) {
|
|
831
|
+
let sameValue = false;
|
|
832
|
+
untracked(() => {
|
|
833
|
+
if (this.thyIsMultiple()) {
|
|
834
|
+
if (oldValue instanceof Array && value instanceof Array && oldValue.length === value.length) {
|
|
835
|
+
sameValue = value.every((option, index) => option.thyValue === oldValue[index].thyValue);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
if (oldValue && value) {
|
|
840
|
+
sameValue = oldValue.thyValue === value.thyValue;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
if (this.thyPanelOpened() && this.thyShowSearch()) {
|
|
844
|
+
if (!sameValue) {
|
|
845
|
+
Promise.resolve(null).then(() => {
|
|
846
|
+
this.inputValue.set('');
|
|
847
|
+
this.updateWidth();
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
//等待组件渲染好再聚焦
|
|
851
|
+
setTimeout(() => {
|
|
852
|
+
if (this.thyPanelOpened()) {
|
|
853
|
+
this.inputElement()?.nativeElement.focus();
|
|
854
|
+
}
|
|
855
|
+
}, 200);
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
});
|
|
913
860
|
}
|
|
861
|
+
ngOnInit() { }
|
|
914
862
|
setSelectControlClass() {
|
|
915
|
-
const modeType = this.
|
|
863
|
+
const modeType = this.thyIsMultiple() ? 'multiple' : 'single';
|
|
916
864
|
const selectControlClass = {
|
|
917
865
|
[`form-control`]: true,
|
|
918
|
-
[`form-control-${this.thySize}`]: !!this.thySize,
|
|
866
|
+
[`form-control-${this.thySize()}`]: !!this.thySize(),
|
|
919
867
|
[`form-control-custom`]: true,
|
|
920
868
|
[`select-control`]: true,
|
|
921
869
|
[`select-control-${modeType}`]: true,
|
|
922
|
-
[`select-control-show-search`]: this.
|
|
923
|
-
[`panel-is-opened`]: this.
|
|
924
|
-
[`disabled`]: this.
|
|
870
|
+
[`select-control-show-search`]: this.thyShowSearch(),
|
|
871
|
+
[`panel-is-opened`]: this.thyPanelOpened(),
|
|
872
|
+
[`disabled`]: this.thyDisabled()
|
|
925
873
|
};
|
|
926
874
|
this.hostRenderer.updateClassByMap(selectControlClass);
|
|
927
875
|
this.searchInputControlClass = {
|
|
928
876
|
[`form-control`]: true,
|
|
929
|
-
[`form-control-${this.thySize}`]: !!this.thySize,
|
|
877
|
+
[`form-control-${this.thySize()}`]: !!this.thySize(),
|
|
930
878
|
[`search-input-field`]: true,
|
|
931
|
-
[`hidden`]: !this.thyShowSearch,
|
|
932
|
-
[`disabled`]: this.thyDisabled
|
|
879
|
+
[`hidden`]: !this.thyShowSearch(),
|
|
880
|
+
[`disabled`]: this.thyDisabled()
|
|
933
881
|
};
|
|
934
882
|
}
|
|
935
883
|
setInputValue(value) {
|
|
936
|
-
if (value !== this.inputValue) {
|
|
937
|
-
this.inputValue
|
|
884
|
+
if (value !== this.inputValue()) {
|
|
885
|
+
this.inputValue.set(value);
|
|
938
886
|
this.updateWidth();
|
|
939
|
-
this.thyOnSearch.emit(this.inputValue);
|
|
887
|
+
this.thyOnSearch.emit(this.inputValue());
|
|
940
888
|
}
|
|
941
889
|
}
|
|
942
890
|
handleBackspace(event) {
|
|
943
891
|
if (event.isComposing) {
|
|
944
892
|
return;
|
|
945
893
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
894
|
+
const selectedOptions = this.thySelectedOptions();
|
|
895
|
+
if (!this.inputValue()?.length && selectedOptions instanceof Array) {
|
|
896
|
+
if (selectedOptions.length > 0) {
|
|
897
|
+
this.removeHandle(selectedOptions[selectedOptions.length - 1], event);
|
|
949
898
|
}
|
|
950
899
|
}
|
|
951
900
|
}
|
|
952
901
|
updateWidth() {
|
|
953
|
-
if (this.
|
|
954
|
-
if (this.inputValue || this.isComposing) {
|
|
955
|
-
this.renderer.setStyle(this.inputElement
|
|
902
|
+
if (this.thyIsMultiple() && this.thyShowSearch()) {
|
|
903
|
+
if (this.inputValue() || this.isComposing()) {
|
|
904
|
+
this.renderer.setStyle(this.inputElement()?.nativeElement, 'width', `${this.inputElement()?.nativeElement.scrollWidth}px`);
|
|
956
905
|
}
|
|
957
906
|
else {
|
|
958
|
-
this.renderer.removeStyle(this.inputElement
|
|
907
|
+
this.renderer.removeStyle(this.inputElement()?.nativeElement, 'width');
|
|
959
908
|
}
|
|
960
909
|
}
|
|
961
910
|
}
|
|
@@ -965,6 +914,9 @@ class ThySelectControl {
|
|
|
965
914
|
clearHandle($event) {
|
|
966
915
|
this.thyOnClear.emit($event);
|
|
967
916
|
}
|
|
917
|
+
compositionChange(isComposing) {
|
|
918
|
+
this.isComposing.set(isComposing);
|
|
919
|
+
}
|
|
968
920
|
trackValue(_index, option) {
|
|
969
921
|
return option.thyValue;
|
|
970
922
|
}
|
|
@@ -972,56 +924,14 @@ class ThySelectControl {
|
|
|
972
924
|
this.thyOnBlur.emit(event);
|
|
973
925
|
}
|
|
974
926
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectControl, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
975
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySelectControl, isStandalone: true, selector: "thy-select-control,[thySelectControl]", inputs: { thyPanelOpened:
|
|
927
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySelectControl, isStandalone: true, selector: "thy-select-control,[thySelectControl]", inputs: { inputValue: { classPropertyName: "inputValue", publicName: "inputValue", isSignal: true, isRequired: false, transformFunction: null }, thyPanelOpened: { classPropertyName: "thyPanelOpened", publicName: "thyPanelOpened", isSignal: true, isRequired: false, transformFunction: null }, thyIsMultiple: { classPropertyName: "thyIsMultiple", publicName: "thyIsMultiple", isSignal: true, isRequired: false, transformFunction: null }, thyShowSearch: { classPropertyName: "thyShowSearch", publicName: "thyShowSearch", isSignal: true, isRequired: false, transformFunction: null }, thySelectedOptions: { classPropertyName: "thySelectedOptions", publicName: "thySelectedOptions", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null }, customDisplayTemplate: { classPropertyName: "customDisplayTemplate", publicName: "customDisplayTemplate", isSignal: true, isRequired: false, transformFunction: null }, thyAllowClear: { classPropertyName: "thyAllowClear", publicName: "thyAllowClear", isSignal: true, isRequired: false, transformFunction: null }, thyPlaceholder: { classPropertyName: "thyPlaceholder", publicName: "thyPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyMaxTagCount: { classPropertyName: "thyMaxTagCount", publicName: "thyMaxTagCount", isSignal: true, isRequired: false, transformFunction: null }, thyBorderless: { classPropertyName: "thyBorderless", publicName: "thyBorderless", isSignal: true, isRequired: false, transformFunction: null }, thyPreset: { classPropertyName: "thyPreset", publicName: "thyPreset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inputValue: "inputValueChange", thyOnSearch: "thyOnSearch", thyOnRemove: "thyOnRemove", thyOnClear: "thyOnClear", thyOnBlur: "thyOnBlur" }, host: { properties: { "class.select-control-borderless": "thyBorderless()" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"compositionChange(true)\"\n (compositionend)=\"compositionChange(false)\"\n autocomplete=\"something-new\"\n [ngClass]=\"searchInputControlClass\"\n (input)=\"updateWidth()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"setInputValue($event)\"\n (keydown.backspace)=\"handleBackspace($event)\"\n [disabled]=\"thyDisabled()\"\n (blur)=\"onBlur($event)\" />\n</ng-template>\n\n<div class=\"select-control-rendered\">\n @if (!isSelectedValue()) {\n <div class=\"text-placeholder text-truncate\" [ngStyle]=\"placeholderStyle()\">\n {{ thyPlaceholder() }}\n </div>\n }\n @if (thyIsMultiple()) {\n <div thyFlex thyWrap=\"wrap\" thyGap=\"4\" thyAlignItems=\"center\" class=\"w-100\">\n @if (thyPreset() === 'tag') {\n @for (item of maxSelectedTags(); track trackValue($index, item)) {\n <div thyFlexItem class=\"custom-choice-item text-truncate\">\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\">\n </ng-template>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n } @else {\n @for (item of maxSelectedTags(); track trackValue($index, item)) {\n <div thyFlexItem thyTag class=\"choice-item\" [ngClass]=\"{ disabled: thyDisabled() === true }\" [thySize]=\"tagSize()\">\n <div class=\"text-truncate h-100\">\n @if (!customDisplayTemplate()) {\n {{ item?.thyLabelText }}\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\"></ng-template>\n }\n </div>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n }\n @if (thyMaxTagCount() && thySelectedOptions()?.length > thyMaxTagCount()) {\n <div\n thyFlexItem\n class=\"choice-item max-tag-count-choice\"\n thyTag\n [thySize]=\"tagSize()\"\n [ngClass]=\"{ disabled: thyDisabled() === true }\"\n [thyTooltip]=\"maxTagTooltip\">\n <div class=\"text-truncate\">+{{ thySelectedOptions()?.length - thyMaxTagCount() + 1 }}</div>\n </div>\n }\n <div thyFlexItem class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n </div>\n } @else {\n @if (isSelectedValue()) {\n <div class=\"selected-value text-truncate\" [ngStyle]=\"selectedValueStyle()\">\n @if (!customDisplayTemplate()) {\n <span class=\"text-truncate\">{{ thySelectedOptions()?.thyLabelText }}</span>\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: thySelectedOptions()?.thyRawValue || thySelectedOptions()?.thyValue || thySelectedOptions()\n }\"></ng-template>\n }\n </div>\n }\n <div class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n }\n</div>\n<span class=\"select-control-arrow\">\n <thy-icon thyIconName=\"angle-down\" class=\"font-size-base\"></thy-icon>\n</span>\n@if (showClearIcon()) {\n <span class=\"select-control-clear remove-link\" (click)=\"clearHandle($event)\">\n <thy-icon class=\"remove-link-icon font-size-base\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </span>\n}\n\n<ng-template #maxTagTooltip>\n @let lastIndex = collapsedSelectedTags().length - 1;\n @for (item of collapsedSelectedTags(); track trackValue($index, item)) {\n {{ item.thyLabelText }}\n @if ($index !== lastIndex) {\n {{ locale().comma }}\n }\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ThyTag, selector: "thy-tag,[thyTag]", inputs: ["thyTag", "thyShape", "thyColor", "thyTheme", "thySize", "thyHoverable"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "ngmodule", type: ThyGridModule }, { kind: "directive", type: i2.ThyFlex, selector: "[thyFlex]", inputs: ["thyDirection", "thyWrap", "thyJustifyContent", "thyAlignItems", "thyGap"] }, { kind: "directive", type: i2.ThyFlexItem, selector: "[thyFlexItem]", inputs: ["thyFlexItem", "thyGrow", "thyShrink", "thyBasis"] }, { kind: "directive", type: ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
976
928
|
}
|
|
977
929
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectControl, decorators: [{
|
|
978
930
|
type: Component,
|
|
979
|
-
args: [{ selector: 'thy-select-control,[thySelectControl]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, NgClass, NgStyle, ThyTag, NgTemplateOutlet, ThyIcon, ThyGridModule], host: {
|
|
980
|
-
'[class.select-control-borderless]': 'thyBorderless'
|
|
981
|
-
}, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"
|
|
982
|
-
}],
|
|
983
|
-
type: Input,
|
|
984
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
985
|
-
}], thyIsMultiple: [{
|
|
986
|
-
type: Input,
|
|
987
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
988
|
-
}], thyShowSearch: [{
|
|
989
|
-
type: Input,
|
|
990
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
991
|
-
}], thySelectedOptions: [{
|
|
992
|
-
type: Input
|
|
993
|
-
}], thyDisabled: [{
|
|
994
|
-
type: Input,
|
|
995
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
996
|
-
}], customDisplayTemplate: [{
|
|
997
|
-
type: Input
|
|
998
|
-
}], thyAllowClear: [{
|
|
999
|
-
type: Input,
|
|
1000
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1001
|
-
}], thyPlaceholder: [{
|
|
1002
|
-
type: Input
|
|
1003
|
-
}], thySize: [{
|
|
1004
|
-
type: Input
|
|
1005
|
-
}], thyMaxTagCount: [{
|
|
1006
|
-
type: Input,
|
|
1007
|
-
args: [{ transform: numberAttribute }]
|
|
1008
|
-
}], thyBorderless: [{
|
|
1009
|
-
type: Input,
|
|
1010
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1011
|
-
}], thyPreset: [{
|
|
1012
|
-
type: Input
|
|
1013
|
-
}], thyOnSearch: [{
|
|
1014
|
-
type: Output
|
|
1015
|
-
}], thyOnRemove: [{
|
|
1016
|
-
type: Output
|
|
1017
|
-
}], thyOnClear: [{
|
|
1018
|
-
type: Output
|
|
1019
|
-
}], thyOnBlur: [{
|
|
1020
|
-
type: Output
|
|
1021
|
-
}], inputElement: [{
|
|
1022
|
-
type: ViewChild,
|
|
1023
|
-
args: ['inputElement']
|
|
1024
|
-
}] } });
|
|
931
|
+
args: [{ selector: 'thy-select-control,[thySelectControl]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, NgClass, NgStyle, ThyTag, NgTemplateOutlet, ThyIcon, ThyGridModule, ThyTooltipDirective], host: {
|
|
932
|
+
'[class.select-control-borderless]': 'thyBorderless()'
|
|
933
|
+
}, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"compositionChange(true)\"\n (compositionend)=\"compositionChange(false)\"\n autocomplete=\"something-new\"\n [ngClass]=\"searchInputControlClass\"\n (input)=\"updateWidth()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"setInputValue($event)\"\n (keydown.backspace)=\"handleBackspace($event)\"\n [disabled]=\"thyDisabled()\"\n (blur)=\"onBlur($event)\" />\n</ng-template>\n\n<div class=\"select-control-rendered\">\n @if (!isSelectedValue()) {\n <div class=\"text-placeholder text-truncate\" [ngStyle]=\"placeholderStyle()\">\n {{ thyPlaceholder() }}\n </div>\n }\n @if (thyIsMultiple()) {\n <div thyFlex thyWrap=\"wrap\" thyGap=\"4\" thyAlignItems=\"center\" class=\"w-100\">\n @if (thyPreset() === 'tag') {\n @for (item of maxSelectedTags(); track trackValue($index, item)) {\n <div thyFlexItem class=\"custom-choice-item text-truncate\">\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\">\n </ng-template>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n } @else {\n @for (item of maxSelectedTags(); track trackValue($index, item)) {\n <div thyFlexItem thyTag class=\"choice-item\" [ngClass]=\"{ disabled: thyDisabled() === true }\" [thySize]=\"tagSize()\">\n <div class=\"text-truncate h-100\">\n @if (!customDisplayTemplate()) {\n {{ item?.thyLabelText }}\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.thyRawValue || item.thyValue || item }\"></ng-template>\n }\n </div>\n @if (!thyDisabled()) {\n <div class=\"choice-remove-link ml-1\" (click)=\"removeHandle(item, $event)\">\n <span>\n <thy-icon thyIconName=\"close\" class=\"font-size-sm\"></thy-icon>\n </span>\n </div>\n }\n </div>\n }\n }\n @if (thyMaxTagCount() && thySelectedOptions()?.length > thyMaxTagCount()) {\n <div\n thyFlexItem\n class=\"choice-item max-tag-count-choice\"\n thyTag\n [thySize]=\"tagSize()\"\n [ngClass]=\"{ disabled: thyDisabled() === true }\"\n [thyTooltip]=\"maxTagTooltip\">\n <div class=\"text-truncate\">+{{ thySelectedOptions()?.length - thyMaxTagCount() + 1 }}</div>\n </div>\n }\n <div thyFlexItem class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n </div>\n } @else {\n @if (isSelectedValue()) {\n <div class=\"selected-value text-truncate\" [ngStyle]=\"selectedValueStyle()\">\n @if (!customDisplayTemplate()) {\n <span class=\"text-truncate\">{{ thySelectedOptions()?.thyLabelText }}</span>\n } @else {\n <ng-template\n [ngTemplateOutlet]=\"customDisplayTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: thySelectedOptions()?.thyRawValue || thySelectedOptions()?.thyValue || thySelectedOptions()\n }\"></ng-template>\n }\n </div>\n }\n <div class=\"select-control-search\">\n <ng-template [ngTemplateOutlet]=\"inputTemplate\"></ng-template>\n </div>\n }\n</div>\n<span class=\"select-control-arrow\">\n <thy-icon thyIconName=\"angle-down\" class=\"font-size-base\"></thy-icon>\n</span>\n@if (showClearIcon()) {\n <span class=\"select-control-clear remove-link\" (click)=\"clearHandle($event)\">\n <thy-icon class=\"remove-link-icon font-size-base\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </span>\n}\n\n<ng-template #maxTagTooltip>\n @let lastIndex = collapsedSelectedTags().length - 1;\n @for (item of collapsedSelectedTags(); track trackValue($index, item)) {\n {{ item.thyLabelText }}\n @if ($index !== lastIndex) {\n {{ locale().comma }}\n }\n }\n</ng-template>\n" }]
|
|
934
|
+
}], ctorParameters: () => [] });
|
|
1025
935
|
|
|
1026
936
|
/**
|
|
1027
937
|
* @license
|
|
@@ -1060,39 +970,26 @@ let _uniqueIdCounter = 0;
|
|
|
1060
970
|
class ThyListOption {
|
|
1061
971
|
constructor() {
|
|
1062
972
|
this.element = inject(ElementRef);
|
|
1063
|
-
this.changeDetector = inject(ChangeDetectorRef);
|
|
1064
973
|
this.parentSelectionList = inject(THY_LIST_OPTION_PARENT_COMPONENT, { optional: true });
|
|
1065
|
-
this.
|
|
1066
|
-
this.
|
|
1067
|
-
this.
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
return this.parentSelectionList.layout === 'grid';
|
|
1074
|
-
}
|
|
1075
|
-
set thyDisabled(value) {
|
|
1076
|
-
this.disabled = value;
|
|
974
|
+
this.role = 'option';
|
|
975
|
+
this.tabIndex = -1;
|
|
976
|
+
this.isMultiple = computed(() => this.parentSelectionList.multiple());
|
|
977
|
+
this.isListOption = computed(() => this.parentSelectionList.layout() === 'list');
|
|
978
|
+
this.isGridOption = computed(() => this.parentSelectionList.layout() === 'grid');
|
|
979
|
+
this.id = input(`thy-list-option-${_uniqueIdCounter++}`);
|
|
980
|
+
this.thyValue = input(undefined);
|
|
981
|
+
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
1077
982
|
}
|
|
1078
983
|
/** Whether the option is selected. */
|
|
1079
984
|
get selected() {
|
|
1080
985
|
return this.parentSelectionList.isSelected(this);
|
|
1081
986
|
}
|
|
1082
987
|
onClick(event) {
|
|
1083
|
-
if (this.parentSelectionList.multiple || !this.parentSelectionList.isSelected(this)) {
|
|
988
|
+
if (this.parentSelectionList.multiple() || !this.parentSelectionList.isSelected(this)) {
|
|
1084
989
|
this.parentSelectionList.toggleOption(this, event);
|
|
1085
990
|
this.parentSelectionList.setActiveOption(this);
|
|
1086
991
|
}
|
|
1087
992
|
}
|
|
1088
|
-
// @HostListener('focus', ['$event'])
|
|
1089
|
-
// onFocus(event: Event) {
|
|
1090
|
-
// this.parentSelectionList.setFocusedOption(this, event);
|
|
1091
|
-
// }
|
|
1092
|
-
/** Allows for programmatic focusing of the option. */
|
|
1093
|
-
// focus(origin?: FocusOrigin): void {
|
|
1094
|
-
// this.element.nativeElement.focus();
|
|
1095
|
-
// }
|
|
1096
993
|
setActiveStyles() {
|
|
1097
994
|
this.element.nativeElement.classList.add('hover');
|
|
1098
995
|
this.parentSelectionList.scrollIntoView(this);
|
|
@@ -1108,37 +1005,19 @@ class ThyListOption {
|
|
|
1108
1005
|
return '';
|
|
1109
1006
|
}
|
|
1110
1007
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyListOption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1111
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyListOption, isStandalone: true, selector: "thy-list-option,[thy-list-option]", inputs: { id: "id", thyValue: "thyValue", thyDisabled:
|
|
1008
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyListOption, isStandalone: true, selector: "thy-list-option,[thy-list-option]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, thyValue: { classPropertyName: "thyValue", publicName: "thyValue", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "class.disabled": "thyDisabled()", "class.thy-list-option": "isListOption()", "class.thy-grid-option": "isGridOption()", "class.active": "selected", "attr.role": "role", "attr.tabindex": "tabIndex" } }, ngImport: i0, template: "<ng-content></ng-content>\n@if (isMultiple() && isListOption()) {\n <span class=\"checked-icon\">\n <thy-icon thyIconName=\"check\"></thy-icon>\n </span>\n}\n@if (isGridOption()) {\n <span class=\"checked-icon\">\n <thy-icon thyIconName=\"check-circle-fill\"></thy-icon>\n </span>\n}\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] }); }
|
|
1112
1009
|
}
|
|
1113
1010
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyListOption, decorators: [{
|
|
1114
1011
|
type: Component,
|
|
1115
|
-
args: [{ selector: 'thy-list-option,[thy-list-option]', imports: [ThyIcon],
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
args: [`attr.role`]
|
|
1125
|
-
}], _tabIndex: [{
|
|
1126
|
-
type: HostBinding,
|
|
1127
|
-
args: [`attr.tabindex`]
|
|
1128
|
-
}], id: [{
|
|
1129
|
-
type: Input
|
|
1130
|
-
}], thyValue: [{
|
|
1131
|
-
type: Input
|
|
1132
|
-
}], thyDisabled: [{
|
|
1133
|
-
type: Input,
|
|
1134
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1135
|
-
}], disabled: [{
|
|
1136
|
-
type: HostBinding,
|
|
1137
|
-
args: [`class.disabled`]
|
|
1138
|
-
}], selected: [{
|
|
1139
|
-
type: HostBinding,
|
|
1140
|
-
args: [`class.active`]
|
|
1141
|
-
}], onClick: [{
|
|
1012
|
+
args: [{ selector: 'thy-list-option,[thy-list-option]', imports: [ThyIcon], host: {
|
|
1013
|
+
'[class.disabled]': 'thyDisabled()',
|
|
1014
|
+
'[class.thy-list-option]': 'isListOption()',
|
|
1015
|
+
'[class.thy-grid-option]': 'isGridOption()',
|
|
1016
|
+
'[class.active]': 'selected',
|
|
1017
|
+
'[attr.role]': 'role',
|
|
1018
|
+
'[attr.tabindex]': 'tabIndex'
|
|
1019
|
+
}, template: "<ng-content></ng-content>\n@if (isMultiple() && isListOption()) {\n <span class=\"checked-icon\">\n <thy-icon thyIconName=\"check\"></thy-icon>\n </span>\n}\n@if (isGridOption()) {\n <span class=\"checked-icon\">\n <thy-icon thyIconName=\"check-circle-fill\"></thy-icon>\n </span>\n}\n" }]
|
|
1020
|
+
}], propDecorators: { onClick: [{
|
|
1142
1021
|
type: HostListener,
|
|
1143
1022
|
args: ['click', ['$event']]
|
|
1144
1023
|
}] } });
|
|
@@ -1180,35 +1059,26 @@ class ThyOptionVisibleChangeEvent {
|
|
|
1180
1059
|
* @order 20
|
|
1181
1060
|
*/
|
|
1182
1061
|
class ThyOption extends SelectOptionBase {
|
|
1183
|
-
|
|
1184
|
-
this._disabled = value;
|
|
1185
|
-
}
|
|
1186
|
-
get thyDisabled() {
|
|
1187
|
-
return this._disabled;
|
|
1188
|
-
}
|
|
1062
|
+
// 继承至 Highlightable,无法修改为 Signal
|
|
1189
1063
|
get disabled() {
|
|
1190
|
-
return this.hidden || this.
|
|
1191
|
-
}
|
|
1192
|
-
get hidden() {
|
|
1193
|
-
return this._hidden;
|
|
1064
|
+
return this.hidden() || this.thyDisabled();
|
|
1194
1065
|
}
|
|
1195
1066
|
get tabIndex() {
|
|
1196
1067
|
return this.disabled ? '-1' : '0';
|
|
1197
1068
|
}
|
|
1198
|
-
get selected() {
|
|
1199
|
-
return this._selected;
|
|
1200
|
-
}
|
|
1201
1069
|
constructor() {
|
|
1202
1070
|
super();
|
|
1203
1071
|
this.element = inject(ElementRef);
|
|
1204
1072
|
this.parent = inject(THY_OPTION_PARENT_COMPONENT, { optional: true });
|
|
1205
1073
|
this.cdr = inject(ChangeDetectorRef);
|
|
1206
|
-
this.
|
|
1207
|
-
this.
|
|
1208
|
-
this.
|
|
1209
|
-
this.
|
|
1210
|
-
this.
|
|
1211
|
-
this.
|
|
1074
|
+
this.thyShowOptionCustom = input();
|
|
1075
|
+
this.thySearchKey = input();
|
|
1076
|
+
this.template = viewChild(TemplateRef);
|
|
1077
|
+
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
1078
|
+
this.hidden = signal(false);
|
|
1079
|
+
this.selected = signal(false);
|
|
1080
|
+
this.selectionChange = output();
|
|
1081
|
+
this.visibleChange = output();
|
|
1212
1082
|
}
|
|
1213
1083
|
getHostElement() {
|
|
1214
1084
|
return this.element.nativeElement;
|
|
@@ -1224,44 +1094,46 @@ class ThyOption extends SelectOptionBase {
|
|
|
1224
1094
|
}
|
|
1225
1095
|
selectViaInteraction() {
|
|
1226
1096
|
if (!this.disabled) {
|
|
1227
|
-
|
|
1097
|
+
const selected = this.parent.isMultiple ? !this.selected() : true;
|
|
1098
|
+
this.selected.set(selected);
|
|
1228
1099
|
this.cdr.markForCheck();
|
|
1229
1100
|
this.emitSelectionChangeEvent(true);
|
|
1230
1101
|
}
|
|
1231
1102
|
}
|
|
1232
1103
|
select(event) {
|
|
1233
1104
|
if (!this.disabled) {
|
|
1234
|
-
if (!this.
|
|
1235
|
-
this.
|
|
1105
|
+
if (!this.selected()) {
|
|
1106
|
+
this.selected.set(true);
|
|
1236
1107
|
this.emitSelectionChangeEvent();
|
|
1237
1108
|
this.cdr.markForCheck();
|
|
1238
1109
|
}
|
|
1239
1110
|
}
|
|
1240
1111
|
}
|
|
1241
1112
|
deselect() {
|
|
1242
|
-
if (this.
|
|
1243
|
-
this.
|
|
1113
|
+
if (this.selected() || this.disabled) {
|
|
1114
|
+
this.selected.set(false);
|
|
1244
1115
|
this.emitSelectionChangeEvent();
|
|
1245
1116
|
this.cdr.markForCheck();
|
|
1246
1117
|
}
|
|
1247
1118
|
}
|
|
1248
1119
|
hideOption() {
|
|
1249
|
-
if (!this.
|
|
1250
|
-
this.
|
|
1120
|
+
if (!this.hidden()) {
|
|
1121
|
+
this.hidden.set(true);
|
|
1251
1122
|
this.visibleChange.emit({ option: this });
|
|
1252
1123
|
this.cdr.markForCheck();
|
|
1253
1124
|
}
|
|
1254
1125
|
}
|
|
1255
1126
|
showOption() {
|
|
1256
|
-
if (this.
|
|
1257
|
-
this.
|
|
1127
|
+
if (this.hidden()) {
|
|
1128
|
+
this.hidden.set(false);
|
|
1258
1129
|
this.visibleChange.emit({ option: this });
|
|
1259
1130
|
this.cdr.markForCheck();
|
|
1260
1131
|
}
|
|
1261
1132
|
}
|
|
1262
1133
|
matchSearchText(searchText) {
|
|
1263
|
-
|
|
1264
|
-
|
|
1134
|
+
const thySearchKey = this.thySearchKey();
|
|
1135
|
+
if (thySearchKey) {
|
|
1136
|
+
if (thySearchKey.toLowerCase().indexOf(searchText.toLowerCase()) >= 0) {
|
|
1265
1137
|
return true;
|
|
1266
1138
|
}
|
|
1267
1139
|
else {
|
|
@@ -1293,46 +1165,23 @@ class ThyOption extends SelectOptionBase {
|
|
|
1293
1165
|
}
|
|
1294
1166
|
ngOnDestroy() { }
|
|
1295
1167
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyOption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1296
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyOption, isStandalone: true, selector: "thy-option", inputs: { thyValue: "thyValue", thyRawValue: "thyRawValue", thyLabelText: "thyLabelText", thyShowOptionCustom: "thyShowOptionCustom", thySearchKey: "thySearchKey", thyDisabled:
|
|
1168
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyOption, isStandalone: true, selector: "thy-option", inputs: { thyValue: { classPropertyName: "thyValue", publicName: "thyValue", isSignal: false, isRequired: false, transformFunction: null }, thyRawValue: { classPropertyName: "thyRawValue", publicName: "thyRawValue", isSignal: false, isRequired: false, transformFunction: null }, thyLabelText: { classPropertyName: "thyLabelText", publicName: "thyLabelText", isSignal: false, isRequired: false, transformFunction: null }, thyShowOptionCustom: { classPropertyName: "thyShowOptionCustom", publicName: "thyShowOptionCustom", isSignal: true, isRequired: false, transformFunction: null }, thySearchKey: { classPropertyName: "thySearchKey", publicName: "thySearchKey", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange", visibleChange: "visibleChange" }, host: { listeners: { "click": "onClick($event)", "keydown": "handleKeydown($event)" }, properties: { "class.disabled": "thyDisabled()", "class.hidden": "hidden()", "attr.tabindex": "tabIndex", "class.active": "selected()" }, classAttribute: "thy-option-item" }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (thyShowOptionCustom()) {\n <ng-content></ng-content>\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n} @else {\n <span class=\"text-truncate\">{{ thyLabelText }}</span>\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n}\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1297
1169
|
}
|
|
1298
1170
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyOption, decorators: [{
|
|
1299
1171
|
type: Component,
|
|
1300
|
-
args: [{ selector: 'thy-option', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ThyIcon],
|
|
1172
|
+
args: [{ selector: 'thy-option', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ThyIcon], host: {
|
|
1173
|
+
class: 'thy-option-item',
|
|
1174
|
+
'[class.disabled]': 'thyDisabled()',
|
|
1175
|
+
'[class.hidden]': 'hidden()',
|
|
1176
|
+
'[attr.tabindex]': `tabIndex`,
|
|
1177
|
+
'[class.active]': 'selected()'
|
|
1178
|
+
}, template: "@if (thyShowOptionCustom()) {\n <ng-content></ng-content>\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n} @else {\n <span class=\"text-truncate\">{{ thyLabelText }}</span>\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n}\n" }]
|
|
1301
1179
|
}], ctorParameters: () => [], propDecorators: { thyValue: [{
|
|
1302
1180
|
type: Input
|
|
1303
1181
|
}], thyRawValue: [{
|
|
1304
1182
|
type: Input
|
|
1305
1183
|
}], thyLabelText: [{
|
|
1306
1184
|
type: Input
|
|
1307
|
-
}], thyShowOptionCustom: [{
|
|
1308
|
-
type: Input
|
|
1309
|
-
}], thySearchKey: [{
|
|
1310
|
-
type: Input
|
|
1311
|
-
}], _isOptionItem: [{
|
|
1312
|
-
type: HostBinding,
|
|
1313
|
-
args: ['class.thy-option-item']
|
|
1314
|
-
}], template: [{
|
|
1315
|
-
type: ViewChild,
|
|
1316
|
-
args: [TemplateRef, { static: true }]
|
|
1317
|
-
}], thyDisabled: [{
|
|
1318
|
-
type: Input,
|
|
1319
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1320
|
-
}, {
|
|
1321
|
-
type: HostBinding,
|
|
1322
|
-
args: [`class.disabled`]
|
|
1323
|
-
}], hidden: [{
|
|
1324
|
-
type: HostBinding,
|
|
1325
|
-
args: ['class.hidden']
|
|
1326
|
-
}], tabIndex: [{
|
|
1327
|
-
type: HostBinding,
|
|
1328
|
-
args: ['attr.tabindex']
|
|
1329
|
-
}], selected: [{
|
|
1330
|
-
type: HostBinding,
|
|
1331
|
-
args: [`class.active`]
|
|
1332
|
-
}], selectionChange: [{
|
|
1333
|
-
type: Output
|
|
1334
|
-
}], visibleChange: [{
|
|
1335
|
-
type: Output
|
|
1336
1185
|
}], onClick: [{
|
|
1337
1186
|
type: HostListener,
|
|
1338
1187
|
args: ['click', ['$event']]
|
|
@@ -1348,19 +1197,17 @@ class ThySelectOptionGroup {
|
|
|
1348
1197
|
constructor() {
|
|
1349
1198
|
this._ngZone = inject(NgZone);
|
|
1350
1199
|
this.cdr = inject(ChangeDetectorRef);
|
|
1351
|
-
this.
|
|
1352
|
-
this.
|
|
1200
|
+
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
1201
|
+
this.hidden = signal(false);
|
|
1202
|
+
this.thyGroupLabel = input(undefined);
|
|
1353
1203
|
this._destroy$ = new Subject();
|
|
1354
1204
|
this.optionVisibleChanges = defer(() => {
|
|
1355
1205
|
if (this.options) {
|
|
1356
|
-
return merge(...this.options.map(option => option.visibleChange));
|
|
1206
|
+
return merge(...this.options.map(option => outputToObservable(option.visibleChange)));
|
|
1357
1207
|
}
|
|
1358
1208
|
return this._ngZone.onStable.asObservable().pipe(take(1), switchMap(() => this.optionVisibleChanges));
|
|
1359
1209
|
});
|
|
1360
1210
|
}
|
|
1361
|
-
get hidden() {
|
|
1362
|
-
return this._hidden;
|
|
1363
|
-
}
|
|
1364
1211
|
ngAfterContentInit() {
|
|
1365
1212
|
this.options.changes.pipe(startWith(null), takeUntil(this._destroy$)).subscribe(() => {
|
|
1366
1213
|
this._resetOptions();
|
|
@@ -1368,10 +1215,10 @@ class ThySelectOptionGroup {
|
|
|
1368
1215
|
}
|
|
1369
1216
|
_resetOptions() {
|
|
1370
1217
|
const changedOrDestroyed$ = merge(this.options.changes, this._destroy$);
|
|
1371
|
-
merge(...this.options.map(option => option.visibleChange))
|
|
1218
|
+
merge(...this.options.map(option => outputToObservable(option.visibleChange)))
|
|
1372
1219
|
.pipe(takeUntil(changedOrDestroyed$), debounceTime(10), map((event) => {
|
|
1373
1220
|
const hasOption = this.options.find(option => {
|
|
1374
|
-
if (!option.hidden) {
|
|
1221
|
+
if (!option.hidden()) {
|
|
1375
1222
|
return true;
|
|
1376
1223
|
}
|
|
1377
1224
|
});
|
|
@@ -1383,7 +1230,7 @@ class ThySelectOptionGroup {
|
|
|
1383
1230
|
}
|
|
1384
1231
|
}))
|
|
1385
1232
|
.subscribe((data) => {
|
|
1386
|
-
this.
|
|
1233
|
+
this.hidden.set(data);
|
|
1387
1234
|
this.cdr.markForCheck();
|
|
1388
1235
|
});
|
|
1389
1236
|
}
|
|
@@ -1392,35 +1239,27 @@ class ThySelectOptionGroup {
|
|
|
1392
1239
|
this._destroy$.complete();
|
|
1393
1240
|
}
|
|
1394
1241
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectOptionGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1395
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1242
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: ThySelectOptionGroup, isStandalone: true, selector: "thy-option-group", inputs: { thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null }, thyGroupLabel: { classPropertyName: "thyGroupLabel", publicName: "thyGroupLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.disabled": "thyDisabled()", "class.thy-select-option-group-hidden": "hidden()" }, classAttribute: "thy-option-item-group" }, queries: [{ propertyName: "options", predicate: ThyOption }], ngImport: i0, template: "<span class=\"group-name text-truncate\">{{ thyGroupLabel() }}</span>\n<ng-content></ng-content>\n" }); }
|
|
1396
1243
|
}
|
|
1397
1244
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectOptionGroup, decorators: [{
|
|
1398
1245
|
type: Component,
|
|
1399
|
-
args: [{ selector: 'thy-option-group',
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
args: [`class.disabled`]
|
|
1406
|
-
}], _isOptionGroup: [{
|
|
1407
|
-
type: HostBinding,
|
|
1408
|
-
args: ['class.thy-option-item-group']
|
|
1409
|
-
}], hidden: [{
|
|
1410
|
-
type: HostBinding,
|
|
1411
|
-
args: ['class.thy-select-option-group-hidden']
|
|
1412
|
-
}], thyGroupLabel: [{
|
|
1413
|
-
type: Input
|
|
1414
|
-
}], options: [{
|
|
1246
|
+
args: [{ selector: 'thy-option-group', host: {
|
|
1247
|
+
class: 'thy-option-item-group',
|
|
1248
|
+
'[class.disabled]': 'thyDisabled()',
|
|
1249
|
+
'[class.thy-select-option-group-hidden]': 'hidden()'
|
|
1250
|
+
}, template: "<span class=\"group-name text-truncate\">{{ thyGroupLabel() }}</span>\n<ng-content></ng-content>\n" }]
|
|
1251
|
+
}], propDecorators: { options: [{
|
|
1415
1252
|
type: ContentChildren,
|
|
1416
1253
|
args: [ThyOption]
|
|
1417
1254
|
}] } });
|
|
1418
1255
|
|
|
1419
1256
|
class ThyOptionsContainer {
|
|
1420
|
-
constructor() {
|
|
1257
|
+
constructor() {
|
|
1258
|
+
this.optionsTemplate = viewChild('options');
|
|
1259
|
+
}
|
|
1421
1260
|
ngOnInit() { }
|
|
1422
1261
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyOptionsContainer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1423
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1262
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: ThyOptionsContainer, isStandalone: true, selector: "thy-options-container", viewQueries: [{ propertyName: "optionsTemplate", first: true, predicate: ["options"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1424
1263
|
<ng-template #options>
|
|
1425
1264
|
<ng-content></ng-content>
|
|
1426
1265
|
</ng-template>
|
|
@@ -1437,10 +1276,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1437
1276
|
`,
|
|
1438
1277
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1439
1278
|
}]
|
|
1440
|
-
}], ctorParameters: () => []
|
|
1441
|
-
type: ViewChild,
|
|
1442
|
-
args: ['options']
|
|
1443
|
-
}] } });
|
|
1279
|
+
}], ctorParameters: () => [] });
|
|
1444
1280
|
|
|
1445
1281
|
/**
|
|
1446
1282
|
* @license
|