ngx-tethys 19.1.0-next.6 → 19.1.0-next.8
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 +19 -0
- package/color-picker/coordinates.directive.d.ts +1 -2
- package/date-picker/abstract-picker.component.d.ts +1 -1
- package/date-picker/base-picker.component.d.ts +1 -0
- package/date-picker/picker.component.d.ts +4 -5
- package/dropdown/dropdown-menu.component.d.ts +1 -1
- package/dropdown/dropdown.directive.d.ts +2 -2
- package/fesm2022/ngx-tethys-cascader.mjs +1 -1
- package/fesm2022/ngx-tethys-cascader.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 +32 -32
- package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +7 -10
- package/fesm2022/ngx-tethys-dropdown.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-image.mjs +5 -7
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +140 -160
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-message.mjs +1 -2
- package/fesm2022/ngx-tethys-message.mjs.map +1 -1
- package/fesm2022/ngx-tethys-select.mjs +1 -1
- package/fesm2022/ngx-tethys-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-shared.mjs +97 -123
- 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-table.mjs +1 -2
- package/fesm2022/ngx-tethys-table.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 +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/image/preview/image-preview.component.d.ts +2 -2
- package/list/selection/selection-list.d.ts +33 -46
- package/package.json +54 -54
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- 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-show.d.ts +2 -2
- package/shared/option/list-option/list-option.component.d.ts +5 -5
- package/shared/option/option.token.d.ts +4 -3
- package/shared/select/select-control/select-control.component.d.ts +8 -7
- package/table/table-column.component.d.ts +15 -5
- package/tooltip/tooltip.directive.d.ts +20 -22
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, inject, ViewContainerRef, effect, Directive, ElementRef, NgZone, Renderer2,
|
|
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';
|
|
@@ -98,7 +98,7 @@ class ThyEnterDirective {
|
|
|
98
98
|
this.ngZone = inject(NgZone);
|
|
99
99
|
this.elementRef = inject(ElementRef);
|
|
100
100
|
this.renderer = inject(Renderer2);
|
|
101
|
-
this.thyEnter =
|
|
101
|
+
this.thyEnter = output();
|
|
102
102
|
this.onKeydown = (event) => {
|
|
103
103
|
const keyCode = event.which || event.keyCode;
|
|
104
104
|
if (keyCode === keycodes.ENTER) {
|
|
@@ -124,9 +124,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
124
124
|
args: [{
|
|
125
125
|
selector: '[thyEnter]'
|
|
126
126
|
}]
|
|
127
|
-
}]
|
|
128
|
-
type: Output
|
|
129
|
-
}] } });
|
|
127
|
+
}] });
|
|
130
128
|
|
|
131
129
|
/**
|
|
132
130
|
* @name thyCtrlEnter
|
|
@@ -136,7 +134,7 @@ class ThyCtrlEnterDirective {
|
|
|
136
134
|
this.ngZone = inject(NgZone);
|
|
137
135
|
this.elementRef = inject(ElementRef);
|
|
138
136
|
this.renderer = inject(Renderer2);
|
|
139
|
-
this.thyCtrlEnter =
|
|
137
|
+
this.thyCtrlEnter = output();
|
|
140
138
|
this.onKeydown = (event) => {
|
|
141
139
|
const keyCode = event.which || event.keyCode;
|
|
142
140
|
if ((event.ctrlKey || event.metaKey) && keyCode === keycodes.ENTER) {
|
|
@@ -163,9 +161,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
163
161
|
args: [{
|
|
164
162
|
selector: '[thyCtrlEnter]'
|
|
165
163
|
}]
|
|
166
|
-
}]
|
|
167
|
-
type: Output
|
|
168
|
-
}] } });
|
|
164
|
+
}] });
|
|
169
165
|
|
|
170
166
|
/**
|
|
171
167
|
* @name thyShow
|
|
@@ -181,7 +177,7 @@ class ThyShowDirective {
|
|
|
181
177
|
this.elementRef = inject(ElementRef);
|
|
182
178
|
this.renderer = inject(Renderer2);
|
|
183
179
|
this.ngZone = inject(NgZone);
|
|
184
|
-
this.thyShowChange =
|
|
180
|
+
this.thyShowChange = output();
|
|
185
181
|
this.hostRenderer = useHostRenderer();
|
|
186
182
|
this.thyShow = input(false, { transform: coerceBooleanProperty });
|
|
187
183
|
effect(() => {
|
|
@@ -190,9 +186,7 @@ class ThyShowDirective {
|
|
|
190
186
|
this.ngZone.runOutsideAngular(() => setTimeout(() => {
|
|
191
187
|
this.unListenEvent = this.renderer.listen('document', 'click', event => {
|
|
192
188
|
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
193
|
-
|
|
194
|
-
this.ngZone.run(() => this.thyShowChange.emit(false));
|
|
195
|
-
}
|
|
189
|
+
this.ngZone.run(() => this.thyShowChange.emit(false));
|
|
196
190
|
this.unListenDocument();
|
|
197
191
|
}
|
|
198
192
|
});
|
|
@@ -215,9 +209,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
215
209
|
args: [{
|
|
216
210
|
selector: '[thyShow]'
|
|
217
211
|
}]
|
|
218
|
-
}], ctorParameters: () => []
|
|
219
|
-
type: Output
|
|
220
|
-
}] } });
|
|
212
|
+
}], ctorParameters: () => [] });
|
|
221
213
|
|
|
222
214
|
/**
|
|
223
215
|
* 阻止事件冒泡
|
|
@@ -279,7 +271,7 @@ class ThyContextMenuDirective {
|
|
|
279
271
|
this.ngZone = inject(NgZone);
|
|
280
272
|
this.elementRef = inject(ElementRef);
|
|
281
273
|
this.renderer = inject(Renderer2);
|
|
282
|
-
this.thyContextMenu =
|
|
274
|
+
this.thyContextMenu = output();
|
|
283
275
|
this.rightClick = (event) => {
|
|
284
276
|
event.preventDefault();
|
|
285
277
|
this.ngZone.run(() => {
|
|
@@ -303,9 +295,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
303
295
|
args: [{
|
|
304
296
|
selector: '[thyContextMenu]'
|
|
305
297
|
}]
|
|
306
|
-
}]
|
|
307
|
-
type: Output
|
|
308
|
-
}] } });
|
|
298
|
+
}] });
|
|
309
299
|
|
|
310
300
|
const passiveEventListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
311
301
|
/**
|
|
@@ -712,38 +702,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
712
702
|
* @private
|
|
713
703
|
*/
|
|
714
704
|
class ThySelectControl {
|
|
715
|
-
get selectedValueStyle() {
|
|
716
|
-
let showSelectedValue = false;
|
|
717
|
-
if (this.thyShowSearch()) {
|
|
718
|
-
if (this.thyPanelOpened()) {
|
|
719
|
-
showSelectedValue = !(this.isComposing || this.inputValue);
|
|
720
|
-
}
|
|
721
|
-
else {
|
|
722
|
-
showSelectedValue = true;
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
else {
|
|
726
|
-
showSelectedValue = true;
|
|
727
|
-
}
|
|
728
|
-
return { display: showSelectedValue ? 'flex' : 'none' };
|
|
729
|
-
}
|
|
730
|
-
get placeholderStyle() {
|
|
731
|
-
let placeholder = true;
|
|
732
|
-
if (this.isSelectedValue()) {
|
|
733
|
-
placeholder = false;
|
|
734
|
-
}
|
|
735
|
-
if (!this.thyPlaceholder()) {
|
|
736
|
-
placeholder = false;
|
|
737
|
-
}
|
|
738
|
-
if (this.isComposing || this.inputValue) {
|
|
739
|
-
placeholder = false;
|
|
740
|
-
}
|
|
741
|
-
return { display: placeholder ? 'block' : 'none' };
|
|
742
|
-
}
|
|
743
705
|
constructor() {
|
|
744
706
|
this.renderer = inject(Renderer2);
|
|
745
|
-
this.inputValue = '';
|
|
746
|
-
this.isComposing = false;
|
|
707
|
+
this.inputValue = model('');
|
|
708
|
+
this.isComposing = signal(false);
|
|
747
709
|
this.hostRenderer = useHostRenderer();
|
|
748
710
|
this.thyPanelOpened = input(false, { transform: coerceBooleanProperty });
|
|
749
711
|
this.thyIsMultiple = input(false, { transform: coerceBooleanProperty });
|
|
@@ -792,13 +754,41 @@ class ThySelectControl {
|
|
|
792
754
|
}
|
|
793
755
|
return selectedOptions;
|
|
794
756
|
});
|
|
757
|
+
this.selectedValueStyle = computed(() => {
|
|
758
|
+
let showSelectedValue = false;
|
|
759
|
+
if (this.thyShowSearch()) {
|
|
760
|
+
if (this.thyPanelOpened()) {
|
|
761
|
+
showSelectedValue = !(this.isComposing() || this.inputValue());
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
showSelectedValue = true;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
else {
|
|
768
|
+
showSelectedValue = true;
|
|
769
|
+
}
|
|
770
|
+
return { display: showSelectedValue ? 'flex' : 'none' };
|
|
771
|
+
});
|
|
772
|
+
this.placeholderStyle = computed(() => {
|
|
773
|
+
let placeholder = true;
|
|
774
|
+
if (this.isSelectedValue()) {
|
|
775
|
+
placeholder = false;
|
|
776
|
+
}
|
|
777
|
+
if (!this.thyPlaceholder()) {
|
|
778
|
+
placeholder = false;
|
|
779
|
+
}
|
|
780
|
+
if (this.isComposing() || this.inputValue()) {
|
|
781
|
+
placeholder = false;
|
|
782
|
+
}
|
|
783
|
+
return { display: placeholder ? 'block' : 'none' };
|
|
784
|
+
});
|
|
795
785
|
effect(() => {
|
|
796
786
|
const panelOpened = this.thyPanelOpened();
|
|
797
787
|
if (panelOpened) {
|
|
798
788
|
untracked(() => {
|
|
799
789
|
if (this.thyShowSearch()) {
|
|
800
790
|
Promise.resolve(null).then(() => {
|
|
801
|
-
this.inputElement()
|
|
791
|
+
this.inputElement()?.nativeElement.focus();
|
|
802
792
|
});
|
|
803
793
|
}
|
|
804
794
|
});
|
|
@@ -807,10 +797,10 @@ class ThySelectControl {
|
|
|
807
797
|
untracked(() => {
|
|
808
798
|
if (this.thyShowSearch()) {
|
|
809
799
|
new Promise(resolve => setTimeout(resolve, 100)).then(() => {
|
|
810
|
-
if (this.inputValue) {
|
|
811
|
-
this.inputValue
|
|
800
|
+
if (this.inputValue()) {
|
|
801
|
+
this.inputValue.set('');
|
|
812
802
|
this.updateWidth();
|
|
813
|
-
this.thyOnSearch.emit(this.inputValue);
|
|
803
|
+
this.thyOnSearch.emit(this.inputValue());
|
|
814
804
|
}
|
|
815
805
|
});
|
|
816
806
|
}
|
|
@@ -821,35 +811,37 @@ class ThySelectControl {
|
|
|
821
811
|
this.setSelectControlClass();
|
|
822
812
|
});
|
|
823
813
|
effect(() => {
|
|
824
|
-
let sameValue = false;
|
|
825
814
|
const oldValue = this.previousSelectedOptions();
|
|
826
815
|
const value = this.thySelectedOptions();
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
if (oldValue && value) {
|
|
835
|
-
sameValue = oldValue.thyValue === value.thyValue;
|
|
816
|
+
if (value) {
|
|
817
|
+
let sameValue = false;
|
|
818
|
+
untracked(() => {
|
|
819
|
+
if (this.thyIsMultiple()) {
|
|
820
|
+
if (oldValue instanceof Array && value instanceof Array && oldValue.length === value.length) {
|
|
821
|
+
sameValue = value.every((option, index) => option.thyValue === oldValue[index].thyValue);
|
|
822
|
+
}
|
|
836
823
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
this.inputValue = '';
|
|
842
|
-
this.updateWidth();
|
|
843
|
-
});
|
|
824
|
+
else {
|
|
825
|
+
if (oldValue && value) {
|
|
826
|
+
sameValue = oldValue.thyValue === value.thyValue;
|
|
827
|
+
}
|
|
844
828
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
829
|
+
if (this.thyPanelOpened() && this.thyShowSearch()) {
|
|
830
|
+
if (!sameValue) {
|
|
831
|
+
Promise.resolve(null).then(() => {
|
|
832
|
+
this.inputValue.set('');
|
|
833
|
+
this.updateWidth();
|
|
834
|
+
});
|
|
849
835
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
836
|
+
//等待组件渲染好再聚焦
|
|
837
|
+
setTimeout(() => {
|
|
838
|
+
if (this.thyPanelOpened()) {
|
|
839
|
+
this.inputElement()?.nativeElement.focus();
|
|
840
|
+
}
|
|
841
|
+
}, 200);
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
}
|
|
853
845
|
});
|
|
854
846
|
}
|
|
855
847
|
ngOnInit() { }
|
|
@@ -875,10 +867,10 @@ class ThySelectControl {
|
|
|
875
867
|
};
|
|
876
868
|
}
|
|
877
869
|
setInputValue(value) {
|
|
878
|
-
if (value !== this.inputValue) {
|
|
879
|
-
this.inputValue
|
|
870
|
+
if (value !== this.inputValue()) {
|
|
871
|
+
this.inputValue.set(value);
|
|
880
872
|
this.updateWidth();
|
|
881
|
-
this.thyOnSearch.emit(this.inputValue);
|
|
873
|
+
this.thyOnSearch.emit(this.inputValue());
|
|
882
874
|
}
|
|
883
875
|
}
|
|
884
876
|
handleBackspace(event) {
|
|
@@ -886,7 +878,7 @@ class ThySelectControl {
|
|
|
886
878
|
return;
|
|
887
879
|
}
|
|
888
880
|
const selectedOptions = this.thySelectedOptions();
|
|
889
|
-
if (!this.inputValue?.length && selectedOptions instanceof Array) {
|
|
881
|
+
if (!this.inputValue()?.length && selectedOptions instanceof Array) {
|
|
890
882
|
if (selectedOptions.length > 0) {
|
|
891
883
|
this.removeHandle(selectedOptions[selectedOptions.length - 1], event);
|
|
892
884
|
}
|
|
@@ -894,11 +886,11 @@ class ThySelectControl {
|
|
|
894
886
|
}
|
|
895
887
|
updateWidth() {
|
|
896
888
|
if (this.thyIsMultiple() && this.thyShowSearch()) {
|
|
897
|
-
if (this.inputValue || this.isComposing) {
|
|
898
|
-
this.renderer.setStyle(this.inputElement()
|
|
889
|
+
if (this.inputValue() || this.isComposing()) {
|
|
890
|
+
this.renderer.setStyle(this.inputElement()?.nativeElement, 'width', `${this.inputElement()?.nativeElement.scrollWidth}px`);
|
|
899
891
|
}
|
|
900
892
|
else {
|
|
901
|
-
this.renderer.removeStyle(this.inputElement()
|
|
893
|
+
this.renderer.removeStyle(this.inputElement()?.nativeElement, 'width');
|
|
902
894
|
}
|
|
903
895
|
}
|
|
904
896
|
}
|
|
@@ -908,6 +900,9 @@ class ThySelectControl {
|
|
|
908
900
|
clearHandle($event) {
|
|
909
901
|
this.thyOnClear.emit($event);
|
|
910
902
|
}
|
|
903
|
+
compositionChange(isComposing) {
|
|
904
|
+
this.isComposing.set(isComposing);
|
|
905
|
+
}
|
|
911
906
|
trackValue(_index, option) {
|
|
912
907
|
return option.thyValue;
|
|
913
908
|
}
|
|
@@ -915,13 +910,13 @@ class ThySelectControl {
|
|
|
915
910
|
this.thyOnBlur.emit(event);
|
|
916
911
|
}
|
|
917
912
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectControl, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
918
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySelectControl, isStandalone: true, selector: "thy-select-control,[thySelectControl]", inputs: { 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: { 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)=\"
|
|
913
|
+
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 <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", 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
919
914
|
}
|
|
920
915
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectControl, decorators: [{
|
|
921
916
|
type: Component,
|
|
922
917
|
args: [{ selector: 'thy-select-control,[thySelectControl]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, NgClass, NgStyle, ThyTag, NgTemplateOutlet, ThyIcon, ThyGridModule], host: {
|
|
923
918
|
'[class.select-control-borderless]': 'thyBorderless()'
|
|
924
|
-
}, template: "<ng-template #inputTemplate>\n <input\n #inputElement\n [tabindex]=\"-1\"\n (compositionstart)=\"
|
|
919
|
+
}, 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 <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" }]
|
|
925
920
|
}], ctorParameters: () => [] });
|
|
926
921
|
|
|
927
922
|
/**
|
|
@@ -962,36 +957,25 @@ class ThyListOption {
|
|
|
962
957
|
constructor() {
|
|
963
958
|
this.element = inject(ElementRef);
|
|
964
959
|
this.parentSelectionList = inject(THY_LIST_OPTION_PARENT_COMPONENT, { optional: true });
|
|
965
|
-
this.
|
|
966
|
-
this.
|
|
960
|
+
this.role = 'option';
|
|
961
|
+
this.tabIndex = -1;
|
|
962
|
+
this.isMultiple = computed(() => this.parentSelectionList.multiple());
|
|
963
|
+
this.isListOption = computed(() => this.parentSelectionList.layout() === 'list');
|
|
964
|
+
this.isGridOption = computed(() => this.parentSelectionList.layout() === 'grid');
|
|
967
965
|
this.id = input(`thy-list-option-${_uniqueIdCounter++}`);
|
|
968
966
|
this.thyValue = input(undefined);
|
|
969
967
|
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
970
968
|
}
|
|
971
|
-
get _isListOption() {
|
|
972
|
-
return this.parentSelectionList.layout === 'list';
|
|
973
|
-
}
|
|
974
|
-
get _parentLayout() {
|
|
975
|
-
return this.parentSelectionList.layout === 'grid';
|
|
976
|
-
}
|
|
977
969
|
/** Whether the option is selected. */
|
|
978
970
|
get selected() {
|
|
979
971
|
return this.parentSelectionList.isSelected(this);
|
|
980
972
|
}
|
|
981
973
|
onClick(event) {
|
|
982
|
-
if (this.parentSelectionList.multiple || !this.parentSelectionList.isSelected(this)) {
|
|
974
|
+
if (this.parentSelectionList.multiple() || !this.parentSelectionList.isSelected(this)) {
|
|
983
975
|
this.parentSelectionList.toggleOption(this, event);
|
|
984
976
|
this.parentSelectionList.setActiveOption(this);
|
|
985
977
|
}
|
|
986
978
|
}
|
|
987
|
-
// @HostListener('focus', ['$event'])
|
|
988
|
-
// onFocus(event: Event) {
|
|
989
|
-
// this.parentSelectionList.setFocusedOption(this, event);
|
|
990
|
-
// }
|
|
991
|
-
/** Allows for programmatic focusing of the option. */
|
|
992
|
-
// focus(origin?: FocusOrigin): void {
|
|
993
|
-
// this.element.nativeElement.focus();
|
|
994
|
-
// }
|
|
995
979
|
setActiveStyles() {
|
|
996
980
|
this.element.nativeElement.classList.add('hover');
|
|
997
981
|
this.parentSelectionList.scrollIntoView(this);
|
|
@@ -1007,29 +991,19 @@ class ThyListOption {
|
|
|
1007
991
|
return '';
|
|
1008
992
|
}
|
|
1009
993
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyListOption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1010
|
-
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": "
|
|
994
|
+
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"] }] }); }
|
|
1011
995
|
}
|
|
1012
996
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyListOption, decorators: [{
|
|
1013
997
|
type: Component,
|
|
1014
998
|
args: [{ selector: 'thy-list-option,[thy-list-option]', imports: [ThyIcon], host: {
|
|
1015
|
-
'[class.disabled]': 'thyDisabled()'
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
}], _role: [{
|
|
1024
|
-
type: HostBinding,
|
|
1025
|
-
args: [`attr.role`]
|
|
1026
|
-
}], _tabIndex: [{
|
|
1027
|
-
type: HostBinding,
|
|
1028
|
-
args: [`attr.tabindex`]
|
|
1029
|
-
}], selected: [{
|
|
1030
|
-
type: HostBinding,
|
|
1031
|
-
args: [`class.active`]
|
|
1032
|
-
}], onClick: [{
|
|
999
|
+
'[class.disabled]': 'thyDisabled()',
|
|
1000
|
+
'[class.thy-list-option]': 'isListOption()',
|
|
1001
|
+
'[class.thy-grid-option]': 'isGridOption()',
|
|
1002
|
+
'[class.active]': 'selected',
|
|
1003
|
+
'[attr.role]': 'role',
|
|
1004
|
+
'[attr.tabindex]': 'tabIndex'
|
|
1005
|
+
}, 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" }]
|
|
1006
|
+
}], propDecorators: { onClick: [{
|
|
1033
1007
|
type: HostListener,
|
|
1034
1008
|
args: ['click', ['$event']]
|
|
1035
1009
|
}] } });
|