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,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,205 +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
|
|
879
|
+
[`hidden`]: !this.thyShowSearch(),
|
|
880
|
+
[`disabled`]: this.thyDisabled()
|
|
932
881
|
};
|
|
933
882
|
}
|
|
934
883
|
setInputValue(value) {
|
|
935
|
-
if (value !== this.inputValue) {
|
|
936
|
-
this.inputValue
|
|
884
|
+
if (value !== this.inputValue()) {
|
|
885
|
+
this.inputValue.set(value);
|
|
937
886
|
this.updateWidth();
|
|
938
|
-
this.thyOnSearch.emit(this.inputValue);
|
|
887
|
+
this.thyOnSearch.emit(this.inputValue());
|
|
939
888
|
}
|
|
940
889
|
}
|
|
941
890
|
handleBackspace(event) {
|
|
942
891
|
if (event.isComposing) {
|
|
943
892
|
return;
|
|
944
893
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
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);
|
|
948
898
|
}
|
|
949
899
|
}
|
|
950
900
|
}
|
|
951
901
|
updateWidth() {
|
|
952
|
-
if (this.
|
|
953
|
-
if (this.inputValue || this.isComposing) {
|
|
954
|
-
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`);
|
|
955
905
|
}
|
|
956
906
|
else {
|
|
957
|
-
this.renderer.removeStyle(this.inputElement
|
|
907
|
+
this.renderer.removeStyle(this.inputElement()?.nativeElement, 'width');
|
|
958
908
|
}
|
|
959
909
|
}
|
|
960
910
|
}
|
|
@@ -964,6 +914,9 @@ class ThySelectControl {
|
|
|
964
914
|
clearHandle($event) {
|
|
965
915
|
this.thyOnClear.emit($event);
|
|
966
916
|
}
|
|
917
|
+
compositionChange(isComposing) {
|
|
918
|
+
this.isComposing.set(isComposing);
|
|
919
|
+
}
|
|
967
920
|
trackValue(_index, option) {
|
|
968
921
|
return option.thyValue;
|
|
969
922
|
}
|
|
@@ -971,56 +924,14 @@ class ThySelectControl {
|
|
|
971
924
|
this.thyOnBlur.emit(event);
|
|
972
925
|
}
|
|
973
926
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectControl, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
974
|
-
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 }); }
|
|
975
928
|
}
|
|
976
929
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectControl, decorators: [{
|
|
977
930
|
type: Component,
|
|
978
|
-
args: [{ selector: 'thy-select-control,[thySelectControl]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, NgClass, NgStyle, ThyTag, NgTemplateOutlet, ThyIcon, ThyGridModule], host: {
|
|
979
|
-
'[class.select-control-borderless]': 'thyBorderless'
|
|
980
|
-
}, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"
|
|
981
|
-
}],
|
|
982
|
-
type: Input,
|
|
983
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
984
|
-
}], thyIsMultiple: [{
|
|
985
|
-
type: Input,
|
|
986
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
987
|
-
}], thyShowSearch: [{
|
|
988
|
-
type: Input,
|
|
989
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
990
|
-
}], thySelectedOptions: [{
|
|
991
|
-
type: Input
|
|
992
|
-
}], thyDisabled: [{
|
|
993
|
-
type: Input,
|
|
994
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
995
|
-
}], customDisplayTemplate: [{
|
|
996
|
-
type: Input
|
|
997
|
-
}], thyAllowClear: [{
|
|
998
|
-
type: Input,
|
|
999
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1000
|
-
}], thyPlaceholder: [{
|
|
1001
|
-
type: Input
|
|
1002
|
-
}], thySize: [{
|
|
1003
|
-
type: Input
|
|
1004
|
-
}], thyMaxTagCount: [{
|
|
1005
|
-
type: Input,
|
|
1006
|
-
args: [{ transform: numberAttribute }]
|
|
1007
|
-
}], thyBorderless: [{
|
|
1008
|
-
type: Input,
|
|
1009
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1010
|
-
}], thyPreset: [{
|
|
1011
|
-
type: Input
|
|
1012
|
-
}], thyOnSearch: [{
|
|
1013
|
-
type: Output
|
|
1014
|
-
}], thyOnRemove: [{
|
|
1015
|
-
type: Output
|
|
1016
|
-
}], thyOnClear: [{
|
|
1017
|
-
type: Output
|
|
1018
|
-
}], thyOnBlur: [{
|
|
1019
|
-
type: Output
|
|
1020
|
-
}], inputElement: [{
|
|
1021
|
-
type: ViewChild,
|
|
1022
|
-
args: ['inputElement']
|
|
1023
|
-
}] } });
|
|
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: () => [] });
|
|
1024
935
|
|
|
1025
936
|
/**
|
|
1026
937
|
* @license
|
|
@@ -1059,39 +970,26 @@ let _uniqueIdCounter = 0;
|
|
|
1059
970
|
class ThyListOption {
|
|
1060
971
|
constructor() {
|
|
1061
972
|
this.element = inject(ElementRef);
|
|
1062
|
-
this.changeDetector = inject(ChangeDetectorRef);
|
|
1063
973
|
this.parentSelectionList = inject(THY_LIST_OPTION_PARENT_COMPONENT, { optional: true });
|
|
1064
|
-
this.
|
|
1065
|
-
this.
|
|
1066
|
-
this.
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
return this.parentSelectionList.layout === 'grid';
|
|
1073
|
-
}
|
|
1074
|
-
set thyDisabled(value) {
|
|
1075
|
-
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 });
|
|
1076
982
|
}
|
|
1077
983
|
/** Whether the option is selected. */
|
|
1078
984
|
get selected() {
|
|
1079
985
|
return this.parentSelectionList.isSelected(this);
|
|
1080
986
|
}
|
|
1081
987
|
onClick(event) {
|
|
1082
|
-
if (this.parentSelectionList.multiple || !this.parentSelectionList.isSelected(this)) {
|
|
988
|
+
if (this.parentSelectionList.multiple() || !this.parentSelectionList.isSelected(this)) {
|
|
1083
989
|
this.parentSelectionList.toggleOption(this, event);
|
|
1084
990
|
this.parentSelectionList.setActiveOption(this);
|
|
1085
991
|
}
|
|
1086
992
|
}
|
|
1087
|
-
// @HostListener('focus', ['$event'])
|
|
1088
|
-
// onFocus(event: Event) {
|
|
1089
|
-
// this.parentSelectionList.setFocusedOption(this, event);
|
|
1090
|
-
// }
|
|
1091
|
-
/** Allows for programmatic focusing of the option. */
|
|
1092
|
-
// focus(origin?: FocusOrigin): void {
|
|
1093
|
-
// this.element.nativeElement.focus();
|
|
1094
|
-
// }
|
|
1095
993
|
setActiveStyles() {
|
|
1096
994
|
this.element.nativeElement.classList.add('hover');
|
|
1097
995
|
this.parentSelectionList.scrollIntoView(this);
|
|
@@ -1107,37 +1005,19 @@ class ThyListOption {
|
|
|
1107
1005
|
return '';
|
|
1108
1006
|
}
|
|
1109
1007
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyListOption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1110
|
-
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"] }] }); }
|
|
1111
1009
|
}
|
|
1112
1010
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyListOption, decorators: [{
|
|
1113
1011
|
type: Component,
|
|
1114
|
-
args: [{ selector: 'thy-list-option,[thy-list-option]', imports: [ThyIcon],
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
args: [`attr.role`]
|
|
1124
|
-
}], _tabIndex: [{
|
|
1125
|
-
type: HostBinding,
|
|
1126
|
-
args: [`attr.tabindex`]
|
|
1127
|
-
}], id: [{
|
|
1128
|
-
type: Input
|
|
1129
|
-
}], thyValue: [{
|
|
1130
|
-
type: Input
|
|
1131
|
-
}], thyDisabled: [{
|
|
1132
|
-
type: Input,
|
|
1133
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1134
|
-
}], disabled: [{
|
|
1135
|
-
type: HostBinding,
|
|
1136
|
-
args: [`class.disabled`]
|
|
1137
|
-
}], selected: [{
|
|
1138
|
-
type: HostBinding,
|
|
1139
|
-
args: [`class.active`]
|
|
1140
|
-
}], 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: [{
|
|
1141
1021
|
type: HostListener,
|
|
1142
1022
|
args: ['click', ['$event']]
|
|
1143
1023
|
}] } });
|
|
@@ -1179,35 +1059,26 @@ class ThyOptionVisibleChangeEvent {
|
|
|
1179
1059
|
* @order 20
|
|
1180
1060
|
*/
|
|
1181
1061
|
class ThyOption extends SelectOptionBase {
|
|
1182
|
-
|
|
1183
|
-
this._disabled = value;
|
|
1184
|
-
}
|
|
1185
|
-
get thyDisabled() {
|
|
1186
|
-
return this._disabled;
|
|
1187
|
-
}
|
|
1062
|
+
// 继承至 Highlightable,无法修改为 Signal
|
|
1188
1063
|
get disabled() {
|
|
1189
|
-
return this.hidden || this.
|
|
1190
|
-
}
|
|
1191
|
-
get hidden() {
|
|
1192
|
-
return this._hidden;
|
|
1064
|
+
return this.hidden() || this.thyDisabled();
|
|
1193
1065
|
}
|
|
1194
1066
|
get tabIndex() {
|
|
1195
1067
|
return this.disabled ? '-1' : '0';
|
|
1196
1068
|
}
|
|
1197
|
-
get selected() {
|
|
1198
|
-
return this._selected;
|
|
1199
|
-
}
|
|
1200
1069
|
constructor() {
|
|
1201
1070
|
super();
|
|
1202
1071
|
this.element = inject(ElementRef);
|
|
1203
1072
|
this.parent = inject(THY_OPTION_PARENT_COMPONENT, { optional: true });
|
|
1204
1073
|
this.cdr = inject(ChangeDetectorRef);
|
|
1205
|
-
this.
|
|
1206
|
-
this.
|
|
1207
|
-
this.
|
|
1208
|
-
this.
|
|
1209
|
-
this.
|
|
1210
|
-
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();
|
|
1211
1082
|
}
|
|
1212
1083
|
getHostElement() {
|
|
1213
1084
|
return this.element.nativeElement;
|
|
@@ -1223,44 +1094,46 @@ class ThyOption extends SelectOptionBase {
|
|
|
1223
1094
|
}
|
|
1224
1095
|
selectViaInteraction() {
|
|
1225
1096
|
if (!this.disabled) {
|
|
1226
|
-
|
|
1097
|
+
const selected = this.parent.isMultiple ? !this.selected() : true;
|
|
1098
|
+
this.selected.set(selected);
|
|
1227
1099
|
this.cdr.markForCheck();
|
|
1228
1100
|
this.emitSelectionChangeEvent(true);
|
|
1229
1101
|
}
|
|
1230
1102
|
}
|
|
1231
1103
|
select(event) {
|
|
1232
1104
|
if (!this.disabled) {
|
|
1233
|
-
if (!this.
|
|
1234
|
-
this.
|
|
1105
|
+
if (!this.selected()) {
|
|
1106
|
+
this.selected.set(true);
|
|
1235
1107
|
this.emitSelectionChangeEvent();
|
|
1236
1108
|
this.cdr.markForCheck();
|
|
1237
1109
|
}
|
|
1238
1110
|
}
|
|
1239
1111
|
}
|
|
1240
1112
|
deselect() {
|
|
1241
|
-
if (this.
|
|
1242
|
-
this.
|
|
1113
|
+
if (this.selected() || this.disabled) {
|
|
1114
|
+
this.selected.set(false);
|
|
1243
1115
|
this.emitSelectionChangeEvent();
|
|
1244
1116
|
this.cdr.markForCheck();
|
|
1245
1117
|
}
|
|
1246
1118
|
}
|
|
1247
1119
|
hideOption() {
|
|
1248
|
-
if (!this.
|
|
1249
|
-
this.
|
|
1120
|
+
if (!this.hidden()) {
|
|
1121
|
+
this.hidden.set(true);
|
|
1250
1122
|
this.visibleChange.emit({ option: this });
|
|
1251
1123
|
this.cdr.markForCheck();
|
|
1252
1124
|
}
|
|
1253
1125
|
}
|
|
1254
1126
|
showOption() {
|
|
1255
|
-
if (this.
|
|
1256
|
-
this.
|
|
1127
|
+
if (this.hidden()) {
|
|
1128
|
+
this.hidden.set(false);
|
|
1257
1129
|
this.visibleChange.emit({ option: this });
|
|
1258
1130
|
this.cdr.markForCheck();
|
|
1259
1131
|
}
|
|
1260
1132
|
}
|
|
1261
1133
|
matchSearchText(searchText) {
|
|
1262
|
-
|
|
1263
|
-
|
|
1134
|
+
const thySearchKey = this.thySearchKey();
|
|
1135
|
+
if (thySearchKey) {
|
|
1136
|
+
if (thySearchKey.toLowerCase().indexOf(searchText.toLowerCase()) >= 0) {
|
|
1264
1137
|
return true;
|
|
1265
1138
|
}
|
|
1266
1139
|
else {
|
|
@@ -1292,46 +1165,23 @@ class ThyOption extends SelectOptionBase {
|
|
|
1292
1165
|
}
|
|
1293
1166
|
ngOnDestroy() { }
|
|
1294
1167
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyOption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1295
|
-
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 }); }
|
|
1296
1169
|
}
|
|
1297
1170
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyOption, decorators: [{
|
|
1298
1171
|
type: Component,
|
|
1299
|
-
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" }]
|
|
1300
1179
|
}], ctorParameters: () => [], propDecorators: { thyValue: [{
|
|
1301
1180
|
type: Input
|
|
1302
1181
|
}], thyRawValue: [{
|
|
1303
1182
|
type: Input
|
|
1304
1183
|
}], thyLabelText: [{
|
|
1305
1184
|
type: Input
|
|
1306
|
-
}], thyShowOptionCustom: [{
|
|
1307
|
-
type: Input
|
|
1308
|
-
}], thySearchKey: [{
|
|
1309
|
-
type: Input
|
|
1310
|
-
}], _isOptionItem: [{
|
|
1311
|
-
type: HostBinding,
|
|
1312
|
-
args: ['class.thy-option-item']
|
|
1313
|
-
}], template: [{
|
|
1314
|
-
type: ViewChild,
|
|
1315
|
-
args: [TemplateRef, { static: true }]
|
|
1316
|
-
}], thyDisabled: [{
|
|
1317
|
-
type: Input,
|
|
1318
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1319
|
-
}, {
|
|
1320
|
-
type: HostBinding,
|
|
1321
|
-
args: [`class.disabled`]
|
|
1322
|
-
}], hidden: [{
|
|
1323
|
-
type: HostBinding,
|
|
1324
|
-
args: ['class.hidden']
|
|
1325
|
-
}], tabIndex: [{
|
|
1326
|
-
type: HostBinding,
|
|
1327
|
-
args: ['attr.tabindex']
|
|
1328
|
-
}], selected: [{
|
|
1329
|
-
type: HostBinding,
|
|
1330
|
-
args: [`class.active`]
|
|
1331
|
-
}], selectionChange: [{
|
|
1332
|
-
type: Output
|
|
1333
|
-
}], visibleChange: [{
|
|
1334
|
-
type: Output
|
|
1335
1185
|
}], onClick: [{
|
|
1336
1186
|
type: HostListener,
|
|
1337
1187
|
args: ['click', ['$event']]
|
|
@@ -1347,19 +1197,17 @@ class ThySelectOptionGroup {
|
|
|
1347
1197
|
constructor() {
|
|
1348
1198
|
this._ngZone = inject(NgZone);
|
|
1349
1199
|
this.cdr = inject(ChangeDetectorRef);
|
|
1350
|
-
this.
|
|
1351
|
-
this.
|
|
1200
|
+
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
1201
|
+
this.hidden = signal(false);
|
|
1202
|
+
this.thyGroupLabel = input(undefined);
|
|
1352
1203
|
this._destroy$ = new Subject();
|
|
1353
1204
|
this.optionVisibleChanges = defer(() => {
|
|
1354
1205
|
if (this.options) {
|
|
1355
|
-
return merge(...this.options.map(option => option.visibleChange));
|
|
1206
|
+
return merge(...this.options.map(option => outputToObservable(option.visibleChange)));
|
|
1356
1207
|
}
|
|
1357
1208
|
return this._ngZone.onStable.asObservable().pipe(take(1), switchMap(() => this.optionVisibleChanges));
|
|
1358
1209
|
});
|
|
1359
1210
|
}
|
|
1360
|
-
get hidden() {
|
|
1361
|
-
return this._hidden;
|
|
1362
|
-
}
|
|
1363
1211
|
ngAfterContentInit() {
|
|
1364
1212
|
this.options.changes.pipe(startWith(null), takeUntil(this._destroy$)).subscribe(() => {
|
|
1365
1213
|
this._resetOptions();
|
|
@@ -1367,10 +1215,10 @@ class ThySelectOptionGroup {
|
|
|
1367
1215
|
}
|
|
1368
1216
|
_resetOptions() {
|
|
1369
1217
|
const changedOrDestroyed$ = merge(this.options.changes, this._destroy$);
|
|
1370
|
-
merge(...this.options.map(option => option.visibleChange))
|
|
1218
|
+
merge(...this.options.map(option => outputToObservable(option.visibleChange)))
|
|
1371
1219
|
.pipe(takeUntil(changedOrDestroyed$), debounceTime(10), map((event) => {
|
|
1372
1220
|
const hasOption = this.options.find(option => {
|
|
1373
|
-
if (!option.hidden) {
|
|
1221
|
+
if (!option.hidden()) {
|
|
1374
1222
|
return true;
|
|
1375
1223
|
}
|
|
1376
1224
|
});
|
|
@@ -1382,7 +1230,7 @@ class ThySelectOptionGroup {
|
|
|
1382
1230
|
}
|
|
1383
1231
|
}))
|
|
1384
1232
|
.subscribe((data) => {
|
|
1385
|
-
this.
|
|
1233
|
+
this.hidden.set(data);
|
|
1386
1234
|
this.cdr.markForCheck();
|
|
1387
1235
|
});
|
|
1388
1236
|
}
|
|
@@ -1391,35 +1239,27 @@ class ThySelectOptionGroup {
|
|
|
1391
1239
|
this._destroy$.complete();
|
|
1392
1240
|
}
|
|
1393
1241
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectOptionGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1394
|
-
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" }); }
|
|
1395
1243
|
}
|
|
1396
1244
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectOptionGroup, decorators: [{
|
|
1397
1245
|
type: Component,
|
|
1398
|
-
args: [{ selector: 'thy-option-group',
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
args: [`class.disabled`]
|
|
1405
|
-
}], _isOptionGroup: [{
|
|
1406
|
-
type: HostBinding,
|
|
1407
|
-
args: ['class.thy-option-item-group']
|
|
1408
|
-
}], hidden: [{
|
|
1409
|
-
type: HostBinding,
|
|
1410
|
-
args: ['class.thy-select-option-group-hidden']
|
|
1411
|
-
}], thyGroupLabel: [{
|
|
1412
|
-
type: Input
|
|
1413
|
-
}], 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: [{
|
|
1414
1252
|
type: ContentChildren,
|
|
1415
1253
|
args: [ThyOption]
|
|
1416
1254
|
}] } });
|
|
1417
1255
|
|
|
1418
1256
|
class ThyOptionsContainer {
|
|
1419
|
-
constructor() {
|
|
1257
|
+
constructor() {
|
|
1258
|
+
this.optionsTemplate = viewChild('options');
|
|
1259
|
+
}
|
|
1420
1260
|
ngOnInit() { }
|
|
1421
1261
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyOptionsContainer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1422
|
-
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: `
|
|
1423
1263
|
<ng-template #options>
|
|
1424
1264
|
<ng-content></ng-content>
|
|
1425
1265
|
</ng-template>
|
|
@@ -1436,10 +1276,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1436
1276
|
`,
|
|
1437
1277
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1438
1278
|
}]
|
|
1439
|
-
}], ctorParameters: () => []
|
|
1440
|
-
type: ViewChild,
|
|
1441
|
-
args: ['options']
|
|
1442
|
-
}] } });
|
|
1279
|
+
}], ctorParameters: () => [] });
|
|
1443
1280
|
|
|
1444
1281
|
/**
|
|
1445
1282
|
* @license
|