@tolle_/tolle-ui 18.2.12 → 18.2.14
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/esm2022/lib/country-selector.component.mjs +99 -81
- package/esm2022/lib/date-picker.component.mjs +17 -13
- package/esm2022/lib/date-range-picker.component.mjs +16 -12
- package/esm2022/lib/multi-select.component.mjs +17 -11
- package/esm2022/lib/popover.component.mjs +14 -14
- package/esm2022/lib/select.component.mjs +14 -12
- package/fesm2022/tolle-ui.mjs +166 -132
- package/fesm2022/tolle-ui.mjs.map +1 -1
- package/lib/country-selector.component.d.ts +3 -1
- package/lib/date-picker.component.d.ts +4 -3
- package/lib/date-range-picker.component.d.ts +4 -3
- package/lib/multi-select.component.d.ts +4 -3
- package/lib/popover.component.d.ts +1 -1
- package/lib/select.component.d.ts +1 -1
- package/package.json +1 -1
package/fesm2022/tolle-ui.mjs
CHANGED
|
@@ -739,6 +739,11 @@ class SelectComponent {
|
|
|
739
739
|
});
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
|
+
_outsideClickHandler = (event) => {
|
|
743
|
+
if (!this.trigger.nativeElement.contains(event.target) && !this.popover?.nativeElement.contains(event.target)) {
|
|
744
|
+
this.close();
|
|
745
|
+
}
|
|
746
|
+
};
|
|
742
747
|
toggle() {
|
|
743
748
|
if (this.disabled || this.readonly)
|
|
744
749
|
return;
|
|
@@ -747,7 +752,10 @@ class SelectComponent {
|
|
|
747
752
|
open() {
|
|
748
753
|
this.isOpen = true;
|
|
749
754
|
this.trigger.nativeElement.focus();
|
|
750
|
-
setTimeout(() =>
|
|
755
|
+
setTimeout(() => {
|
|
756
|
+
this.updatePosition();
|
|
757
|
+
document.addEventListener('mousedown', this._outsideClickHandler);
|
|
758
|
+
});
|
|
751
759
|
}
|
|
752
760
|
close() {
|
|
753
761
|
this.isOpen = false;
|
|
@@ -755,6 +763,7 @@ class SelectComponent {
|
|
|
755
763
|
this.onSearchChange('');
|
|
756
764
|
if (this.cleanupAutoUpdate)
|
|
757
765
|
this.cleanupAutoUpdate();
|
|
766
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
758
767
|
}
|
|
759
768
|
updatePosition() {
|
|
760
769
|
if (!this.trigger || !this.popover)
|
|
@@ -799,11 +808,6 @@ class SelectComponent {
|
|
|
799
808
|
});
|
|
800
809
|
this.noResults = visibleCount === 0 && filter !== '';
|
|
801
810
|
}
|
|
802
|
-
onDocumentClick(event) {
|
|
803
|
-
if (this.isOpen && !this.trigger.nativeElement.contains(event.target) && !this.popover.nativeElement.contains(event.target)) {
|
|
804
|
-
this.close();
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
811
|
writeValue(value) {
|
|
808
812
|
this.value = value;
|
|
809
813
|
this.updateItemSelection();
|
|
@@ -820,9 +824,10 @@ class SelectComponent {
|
|
|
820
824
|
this.sub.unsubscribe();
|
|
821
825
|
if (this.cleanupAutoUpdate)
|
|
822
826
|
this.cleanupAutoUpdate();
|
|
827
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
823
828
|
}
|
|
824
829
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SelectComponent, deps: [{ token: SelectService }], target: i0.ɵɵFactoryTarget.Component });
|
|
825
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: SelectComponent, isStandalone: true, selector: "tolle-select", inputs: { placeholder: "placeholder", class: "class", disabled: "disabled", searchable: "searchable", size: "size", readonly: "readonly" },
|
|
830
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: SelectComponent, isStandalone: true, selector: "tolle-select", inputs: { placeholder: "placeholder", class: "class", disabled: "disabled", searchable: "searchable", size: "size", readonly: "readonly" }, providers: [
|
|
826
831
|
SelectService,
|
|
827
832
|
{
|
|
828
833
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -949,9 +954,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
949
954
|
}], items: [{
|
|
950
955
|
type: ContentChildren,
|
|
951
956
|
args: [SelectItemComponent, { descendants: true }]
|
|
952
|
-
}], onDocumentClick: [{
|
|
953
|
-
type: HostListener,
|
|
954
|
-
args: ['document:mousedown', ['$event']]
|
|
955
957
|
}] } });
|
|
956
958
|
|
|
957
959
|
class SelectGroupComponent {
|
|
@@ -2024,6 +2026,11 @@ class MultiSelectComponent {
|
|
|
2024
2026
|
return Infinity;
|
|
2025
2027
|
return Math.max(0, this.maxSelections - this.value.length);
|
|
2026
2028
|
}
|
|
2029
|
+
_outsideClickHandler = (event) => {
|
|
2030
|
+
if (!this.trigger.nativeElement.contains(event.target) && !this.popover?.nativeElement.contains(event.target)) {
|
|
2031
|
+
this.close();
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2027
2034
|
toggle() {
|
|
2028
2035
|
if (this.disabled)
|
|
2029
2036
|
return;
|
|
@@ -2031,7 +2038,10 @@ class MultiSelectComponent {
|
|
|
2031
2038
|
}
|
|
2032
2039
|
open() {
|
|
2033
2040
|
this.isOpen = true;
|
|
2034
|
-
setTimeout(() =>
|
|
2041
|
+
setTimeout(() => {
|
|
2042
|
+
this.updatePosition();
|
|
2043
|
+
document.addEventListener('mousedown', this._outsideClickHandler);
|
|
2044
|
+
});
|
|
2035
2045
|
}
|
|
2036
2046
|
close() {
|
|
2037
2047
|
this.isOpen = false;
|
|
@@ -2039,6 +2049,7 @@ class MultiSelectComponent {
|
|
|
2039
2049
|
this.onSearchChange('');
|
|
2040
2050
|
if (this.cleanup)
|
|
2041
2051
|
this.cleanup();
|
|
2052
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
2042
2053
|
}
|
|
2043
2054
|
updatePosition() {
|
|
2044
2055
|
if (!this.trigger || !this.popover)
|
|
@@ -2138,10 +2149,10 @@ class MultiSelectComponent {
|
|
|
2138
2149
|
});
|
|
2139
2150
|
this.noResults = visibleCount === 0 && filter !== '';
|
|
2140
2151
|
}
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2152
|
+
ngOnDestroy() {
|
|
2153
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
2154
|
+
if (this.cleanup)
|
|
2155
|
+
this.cleanup();
|
|
2145
2156
|
}
|
|
2146
2157
|
// ControlValueAccessor
|
|
2147
2158
|
onChange = () => { };
|
|
@@ -2155,7 +2166,7 @@ class MultiSelectComponent {
|
|
|
2155
2166
|
setDisabledState(isDisabled) { this.disabled = isDisabled; }
|
|
2156
2167
|
cn = cn;
|
|
2157
2168
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MultiSelectComponent, deps: [{ token: SelectService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2158
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: MultiSelectComponent, isStandalone: true, selector: "tolle-multi-select", inputs: { placeholder: "placeholder", size: "size", searchable: "searchable", disabled: "disabled", class: "class", maxSelections: "maxSelections", maxDisplayItems: "maxDisplayItems", error: "error" },
|
|
2169
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: MultiSelectComponent, isStandalone: true, selector: "tolle-multi-select", inputs: { placeholder: "placeholder", size: "size", searchable: "searchable", disabled: "disabled", class: "class", maxSelections: "maxSelections", maxDisplayItems: "maxDisplayItems", error: "error" }, providers: [
|
|
2159
2170
|
SelectService,
|
|
2160
2171
|
{ provide: NG_VALUE_ACCESSOR, useExisting: MultiSelectComponent, multi: true }
|
|
2161
2172
|
], queries: [{ propertyName: "items", predicate: SelectItemComponent, descendants: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "popover", first: true, predicate: ["popover"], descendants: true }], ngImport: i0, template: `
|
|
@@ -2353,9 +2364,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
2353
2364
|
}], items: [{
|
|
2354
2365
|
type: ContentChildren,
|
|
2355
2366
|
args: [SelectItemComponent, { descendants: true }]
|
|
2356
|
-
}], onClickOutside: [{
|
|
2357
|
-
type: HostListener,
|
|
2358
|
-
args: ['document:mousedown', ['$event']]
|
|
2359
2367
|
}] } });
|
|
2360
2368
|
|
|
2361
2369
|
class CalendarComponent {
|
|
@@ -3218,6 +3226,11 @@ class DatePickerComponent {
|
|
|
3218
3226
|
inputValue = '';
|
|
3219
3227
|
isOpen = false;
|
|
3220
3228
|
cleanupAutoUpdate;
|
|
3229
|
+
_outsideClickHandler = (event) => {
|
|
3230
|
+
if (!this.triggerContainer.nativeElement.contains(event.target) && !this.popover?.nativeElement.contains(event.target)) {
|
|
3231
|
+
this.close();
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
3221
3234
|
constructor(cdr) {
|
|
3222
3235
|
this.cdr = cdr;
|
|
3223
3236
|
}
|
|
@@ -3298,12 +3311,16 @@ class DatePickerComponent {
|
|
|
3298
3311
|
}
|
|
3299
3312
|
open() {
|
|
3300
3313
|
this.isOpen = true;
|
|
3301
|
-
setTimeout(() =>
|
|
3314
|
+
setTimeout(() => {
|
|
3315
|
+
this.updatePosition();
|
|
3316
|
+
document.addEventListener('mousedown', this._outsideClickHandler);
|
|
3317
|
+
});
|
|
3302
3318
|
}
|
|
3303
3319
|
close() {
|
|
3304
3320
|
this.isOpen = false;
|
|
3305
3321
|
if (this.cleanupAutoUpdate)
|
|
3306
3322
|
this.cleanupAutoUpdate();
|
|
3323
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
3307
3324
|
}
|
|
3308
3325
|
clear(event) {
|
|
3309
3326
|
event.stopPropagation();
|
|
@@ -3334,12 +3351,10 @@ class DatePickerComponent {
|
|
|
3334
3351
|
});
|
|
3335
3352
|
});
|
|
3336
3353
|
}
|
|
3337
|
-
|
|
3338
|
-
if (this.
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
this.close();
|
|
3342
|
-
}
|
|
3354
|
+
ngOnDestroy() {
|
|
3355
|
+
if (this.cleanupAutoUpdate)
|
|
3356
|
+
this.cleanupAutoUpdate();
|
|
3357
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
3343
3358
|
}
|
|
3344
3359
|
// CVA Implementation
|
|
3345
3360
|
onChange = () => { };
|
|
@@ -3363,7 +3378,7 @@ class DatePickerComponent {
|
|
|
3363
3378
|
setDisabledState(isDisabled) { this.disabled = isDisabled; }
|
|
3364
3379
|
cn = cn;
|
|
3365
3380
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DatePickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3366
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: DatePickerComponent, isStandalone: true, selector: "tolle-date-picker", inputs: { placeholder: "placeholder", disabled: "disabled", class: "class", disablePastDates: "disablePastDates", showClear: "showClear", showQuickActions: "showQuickActions", minDate: "minDate", maxDate: "maxDate", mode: "mode", formatMonthFn: "formatMonthFn", formatYearFn: "formatYearFn", displayFormat: "displayFormat" },
|
|
3381
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: DatePickerComponent, isStandalone: true, selector: "tolle-date-picker", inputs: { placeholder: "placeholder", disabled: "disabled", class: "class", disablePastDates: "disablePastDates", showClear: "showClear", showQuickActions: "showQuickActions", minDate: "minDate", maxDate: "maxDate", mode: "mode", formatMonthFn: "formatMonthFn", formatYearFn: "formatYearFn", displayFormat: "displayFormat" }, providers: [
|
|
3367
3382
|
{
|
|
3368
3383
|
provide: NG_VALUE_ACCESSOR,
|
|
3369
3384
|
useExisting: forwardRef(() => DatePickerComponent),
|
|
@@ -3508,9 +3523,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
3508
3523
|
}], popover: [{
|
|
3509
3524
|
type: ViewChild,
|
|
3510
3525
|
args: ['popover']
|
|
3511
|
-
}], onClickOutside: [{
|
|
3512
|
-
type: HostListener,
|
|
3513
|
-
args: ['document:mousedown', ['$event']]
|
|
3514
3526
|
}] } });
|
|
3515
3527
|
|
|
3516
3528
|
class PaginationComponent {
|
|
@@ -3815,19 +3827,28 @@ class PopoverComponent {
|
|
|
3815
3827
|
popoverEl;
|
|
3816
3828
|
isOpen = false;
|
|
3817
3829
|
cleanup;
|
|
3830
|
+
_outsideClickHandler = (event) => {
|
|
3831
|
+
if (!this.triggerEl.nativeElement.contains(event.target) && !this.popoverEl?.nativeElement.contains(event.target)) {
|
|
3832
|
+
this.close();
|
|
3833
|
+
}
|
|
3834
|
+
};
|
|
3818
3835
|
toggle() {
|
|
3819
3836
|
this.isOpen ? this.close() : this.open();
|
|
3820
3837
|
}
|
|
3821
3838
|
open() {
|
|
3822
3839
|
this.isOpen = true;
|
|
3823
3840
|
this.onOpen.emit();
|
|
3824
|
-
setTimeout(() =>
|
|
3841
|
+
setTimeout(() => {
|
|
3842
|
+
this.updatePosition();
|
|
3843
|
+
document.addEventListener('mousedown', this._outsideClickHandler);
|
|
3844
|
+
});
|
|
3825
3845
|
}
|
|
3826
3846
|
close() {
|
|
3827
3847
|
this.isOpen = false;
|
|
3828
3848
|
this.onClose.emit();
|
|
3829
3849
|
if (this.cleanup)
|
|
3830
3850
|
this.cleanup();
|
|
3851
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
3831
3852
|
}
|
|
3832
3853
|
updatePosition() {
|
|
3833
3854
|
if (!this.triggerEl || !this.popoverEl)
|
|
@@ -3846,19 +3867,13 @@ class PopoverComponent {
|
|
|
3846
3867
|
});
|
|
3847
3868
|
});
|
|
3848
3869
|
}
|
|
3849
|
-
onClickOutside(event) {
|
|
3850
|
-
if (this.isOpen &&
|
|
3851
|
-
!this.triggerEl.nativeElement.contains(event.target) &&
|
|
3852
|
-
!this.popoverEl?.nativeElement.contains(event.target)) {
|
|
3853
|
-
this.close();
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3856
3870
|
ngOnDestroy() {
|
|
3857
3871
|
if (this.cleanup)
|
|
3858
3872
|
this.cleanup();
|
|
3873
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
3859
3874
|
}
|
|
3860
3875
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3861
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: PopoverComponent, isStandalone: true, selector: "tolle-popover", inputs: { placement: "placement" }, outputs: { onOpen: "onOpen", onClose: "onClose" },
|
|
3876
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: PopoverComponent, isStandalone: true, selector: "tolle-popover", inputs: { placement: "placement" }, outputs: { onOpen: "onOpen", onClose: "onClose" }, viewQueries: [{ propertyName: "triggerEl", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "popoverEl", first: true, predicate: ["popover"], descendants: true }], ngImport: i0, template: `
|
|
3862
3877
|
<div class="inline-block" #trigger (click)="toggle()">
|
|
3863
3878
|
<ng-content select="[trigger]"></ng-content>
|
|
3864
3879
|
</div>
|
|
@@ -3906,9 +3921,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
3906
3921
|
}], popoverEl: [{
|
|
3907
3922
|
type: ViewChild,
|
|
3908
3923
|
args: ['popover']
|
|
3909
|
-
}], onClickOutside: [{
|
|
3910
|
-
type: HostListener,
|
|
3911
|
-
args: ['document:mousedown', ['$event']]
|
|
3912
3924
|
}] } });
|
|
3913
3925
|
|
|
3914
3926
|
class PopoverContentComponent {
|
|
@@ -5157,6 +5169,11 @@ class DateRangePickerComponent {
|
|
|
5157
5169
|
value = { start: null, end: null };
|
|
5158
5170
|
isOpen = false;
|
|
5159
5171
|
cleanupAutoUpdate;
|
|
5172
|
+
_outsideClickHandler = (event) => {
|
|
5173
|
+
if (!this.triggerContainer.nativeElement.contains(event.target) && !this.popover?.nativeElement.contains(event.target)) {
|
|
5174
|
+
this.close();
|
|
5175
|
+
}
|
|
5176
|
+
};
|
|
5160
5177
|
constructor(cdr) {
|
|
5161
5178
|
this.cdr = cdr;
|
|
5162
5179
|
}
|
|
@@ -5185,7 +5202,10 @@ class DateRangePickerComponent {
|
|
|
5185
5202
|
}
|
|
5186
5203
|
open() {
|
|
5187
5204
|
this.isOpen = true;
|
|
5188
|
-
setTimeout(() =>
|
|
5205
|
+
setTimeout(() => {
|
|
5206
|
+
this.updatePosition();
|
|
5207
|
+
document.addEventListener('mousedown', this._outsideClickHandler);
|
|
5208
|
+
});
|
|
5189
5209
|
}
|
|
5190
5210
|
close() {
|
|
5191
5211
|
this.isOpen = false;
|
|
@@ -5193,6 +5213,7 @@ class DateRangePickerComponent {
|
|
|
5193
5213
|
this.cleanupAutoUpdate();
|
|
5194
5214
|
this.cleanupAutoUpdate = undefined;
|
|
5195
5215
|
}
|
|
5216
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
5196
5217
|
}
|
|
5197
5218
|
clear(event) {
|
|
5198
5219
|
event.stopPropagation();
|
|
@@ -5242,12 +5263,10 @@ class DateRangePickerComponent {
|
|
|
5242
5263
|
});
|
|
5243
5264
|
});
|
|
5244
5265
|
}
|
|
5245
|
-
|
|
5246
|
-
if (this.
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
this.close();
|
|
5250
|
-
}
|
|
5266
|
+
ngOnDestroy() {
|
|
5267
|
+
if (this.cleanupAutoUpdate)
|
|
5268
|
+
this.cleanupAutoUpdate();
|
|
5269
|
+
document.removeEventListener('mousedown', this._outsideClickHandler);
|
|
5251
5270
|
}
|
|
5252
5271
|
onWindowResize() {
|
|
5253
5272
|
if (this.isOpen) {
|
|
@@ -5274,7 +5293,7 @@ class DateRangePickerComponent {
|
|
|
5274
5293
|
setDisabledState(isDisabled) { this.disabled = isDisabled; }
|
|
5275
5294
|
cn = cn;
|
|
5276
5295
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DateRangePickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
5277
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: DateRangePickerComponent, isStandalone: true, selector: "tolle-date-range-picker", inputs: { disabled: "disabled", placeholder: "placeholder", class: "class", disablePastDates: "disablePastDates", size: "size" }, host: { listeners: { "
|
|
5296
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: DateRangePickerComponent, isStandalone: true, selector: "tolle-date-range-picker", inputs: { disabled: "disabled", placeholder: "placeholder", class: "class", disablePastDates: "disablePastDates", size: "size" }, host: { listeners: { "window:resize": "onWindowResize()", "window:scroll": "onWindowScroll()" } }, providers: [
|
|
5278
5297
|
{
|
|
5279
5298
|
provide: NG_VALUE_ACCESSOR,
|
|
5280
5299
|
useExisting: forwardRef(() => DateRangePickerComponent),
|
|
@@ -5383,9 +5402,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
5383
5402
|
}], popover: [{
|
|
5384
5403
|
type: ViewChild,
|
|
5385
5404
|
args: ['popover']
|
|
5386
|
-
}], onClickOutside: [{
|
|
5387
|
-
type: HostListener,
|
|
5388
|
-
args: ['document:mousedown', ['$event']]
|
|
5389
5405
|
}], onWindowResize: [{
|
|
5390
5406
|
type: HostListener,
|
|
5391
5407
|
args: ['window:resize']
|
|
@@ -12916,6 +12932,7 @@ class CountrySelectorComponent {
|
|
|
12916
12932
|
showName = true;
|
|
12917
12933
|
onSelect = new EventEmitter();
|
|
12918
12934
|
popover;
|
|
12935
|
+
searchInput;
|
|
12919
12936
|
countryCodesService = inject(CountryCodesService);
|
|
12920
12937
|
sanitizer = inject(DomSanitizer);
|
|
12921
12938
|
cdr = inject(ChangeDetectorRef);
|
|
@@ -12942,20 +12959,20 @@ class CountrySelectorComponent {
|
|
|
12942
12959
|
'focus:ring-4',
|
|
12943
12960
|
'focus:ring-ring/30',
|
|
12944
12961
|
'focus:ring-offset-0',
|
|
12945
|
-
'focus:border-primary/80'
|
|
12962
|
+
'focus:border-primary/80',
|
|
12946
12963
|
], !(this.readonly || this.disabled) && 'hover:border-accent', this.error && [
|
|
12947
12964
|
'border-destructive',
|
|
12948
12965
|
!(this.readonly || this.disabled) && [
|
|
12949
12966
|
'focus:border-destructive/80',
|
|
12950
|
-
'focus:ring-destructive/30'
|
|
12951
|
-
]
|
|
12967
|
+
'focus:ring-destructive/30',
|
|
12968
|
+
],
|
|
12952
12969
|
], this.disabled && 'cursor-not-allowed opacity-50 border-opacity-50', this.readonly && 'cursor-default border-dashed', this.class);
|
|
12953
12970
|
}
|
|
12954
12971
|
get computedLabelClass() {
|
|
12955
|
-
return cn(
|
|
12972
|
+
return cn('text-sm font-medium text-foreground leading-none transition-opacity duration-200', this.disabled && 'opacity-50');
|
|
12956
12973
|
}
|
|
12957
12974
|
get iconClass() {
|
|
12958
|
-
return cn('ri-arrow-down-s-line text-muted-foreground ml-2 transition-transform duration-200', this.popover?.isOpen ? 'rotate-180' : '',
|
|
12975
|
+
return cn('ri-arrow-down-s-line text-muted-foreground ml-2 transition-transform duration-200', this.popover?.isOpen ? 'rotate-180' : '', this.size === 'xs' || this.size === 'sm' ? 'text-[14px]' : 'text-[18px]', (this.disabled || this.readonly) && 'opacity-30');
|
|
12959
12976
|
}
|
|
12960
12977
|
getItemClass(country) {
|
|
12961
12978
|
const isSelected = this.selectedCountry?.isoAlpha2 === country.isoAlpha2;
|
|
@@ -12979,11 +12996,16 @@ class CountrySelectorComponent {
|
|
|
12979
12996
|
}
|
|
12980
12997
|
getReturnValue(country) {
|
|
12981
12998
|
switch (this.returnValue) {
|
|
12982
|
-
case 'object':
|
|
12983
|
-
|
|
12984
|
-
case '
|
|
12985
|
-
|
|
12986
|
-
|
|
12999
|
+
case 'object':
|
|
13000
|
+
return country;
|
|
13001
|
+
case 'isoAlpha2':
|
|
13002
|
+
return country.isoAlpha2;
|
|
13003
|
+
case 'dialCode':
|
|
13004
|
+
return country.dialCode;
|
|
13005
|
+
case 'name':
|
|
13006
|
+
return country.name;
|
|
13007
|
+
default:
|
|
13008
|
+
return country.isoAlpha2;
|
|
12987
13009
|
}
|
|
12988
13010
|
}
|
|
12989
13011
|
onFocus() {
|
|
@@ -12993,6 +13015,11 @@ class CountrySelectorComponent {
|
|
|
12993
13015
|
this.isFocused = false;
|
|
12994
13016
|
this.onTouched();
|
|
12995
13017
|
}
|
|
13018
|
+
onPopoverOpen() {
|
|
13019
|
+
setTimeout(() => {
|
|
13020
|
+
this.searchInput?.nativeElement?.focus();
|
|
13021
|
+
}, 0);
|
|
13022
|
+
}
|
|
12996
13023
|
onPopoverClose() {
|
|
12997
13024
|
this.searchQuery = '';
|
|
12998
13025
|
this.filterCountries('');
|
|
@@ -13018,26 +13045,33 @@ class CountrySelectorComponent {
|
|
|
13018
13045
|
}
|
|
13019
13046
|
this.cdr.markForCheck();
|
|
13020
13047
|
}
|
|
13021
|
-
registerOnChange(fn) {
|
|
13022
|
-
|
|
13023
|
-
|
|
13048
|
+
registerOnChange(fn) {
|
|
13049
|
+
this.onChange = fn;
|
|
13050
|
+
}
|
|
13051
|
+
registerOnTouched(fn) {
|
|
13052
|
+
this.onTouched = fn;
|
|
13053
|
+
}
|
|
13054
|
+
setDisabledState(isDisabled) {
|
|
13055
|
+
this.disabled = isDisabled;
|
|
13056
|
+
}
|
|
13024
13057
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CountrySelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
13025
13058
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: CountrySelectorComponent, isStandalone: true, selector: "tolle-country-selector", inputs: { id: "id", label: "label", hint: "hint", errorMessage: "errorMessage", error: "error", hideHintOnFocus: "hideHintOnFocus", placeholder: "placeholder", class: "class", disabled: "disabled", readonly: "readonly", size: "size", defaultCountryCode: "defaultCountryCode", returnValue: "returnValue", showName: "showName" }, outputs: { onSelect: "onSelect" }, providers: [
|
|
13026
13059
|
{
|
|
13027
13060
|
provide: NG_VALUE_ACCESSOR,
|
|
13028
13061
|
useExisting: forwardRef(() => CountrySelectorComponent),
|
|
13029
|
-
multi: true
|
|
13030
|
-
}
|
|
13031
|
-
], viewQueries: [{ propertyName: "popover", first: true, predicate: ["popover"], descendants: true }], ngImport: i0, template: `
|
|
13032
|
-
<div class="flex flex-col gap-1.5
|
|
13033
|
-
<label
|
|
13034
|
-
*ngIf="label"
|
|
13035
|
-
[for]="id"
|
|
13036
|
-
[class]="computedLabelClass">
|
|
13062
|
+
multi: true,
|
|
13063
|
+
},
|
|
13064
|
+
], viewQueries: [{ propertyName: "popover", first: true, predicate: ["popover"], descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }], ngImport: i0, template: `
|
|
13065
|
+
<div class="flex w-full flex-col gap-1.5">
|
|
13066
|
+
<label *ngIf="label" [for]="id" [class]="computedLabelClass">
|
|
13037
13067
|
{{ label }}
|
|
13038
13068
|
</label>
|
|
13039
13069
|
|
|
13040
|
-
<tolle-popover
|
|
13070
|
+
<tolle-popover
|
|
13071
|
+
#popover
|
|
13072
|
+
[placement]="'bottom-start'"
|
|
13073
|
+
(onOpen)="onPopoverOpen()"
|
|
13074
|
+
(onClose)="onPopoverClose()">
|
|
13041
13075
|
<div trigger class="w-full">
|
|
13042
13076
|
<button
|
|
13043
13077
|
type="button"
|
|
@@ -13047,19 +13081,17 @@ class CountrySelectorComponent {
|
|
|
13047
13081
|
(blur)="onBlur()"
|
|
13048
13082
|
(focus)="onFocus()"
|
|
13049
13083
|
[attr.aria-invalid]="error"
|
|
13050
|
-
[attr.aria-describedby]="error && errorMessage ? id + '-error' : null"
|
|
13051
|
-
>
|
|
13084
|
+
[attr.aria-describedby]="error && errorMessage ? id + '-error' : null">
|
|
13052
13085
|
<div class="flex items-center gap-2 truncate">
|
|
13053
13086
|
<img
|
|
13054
13087
|
*ngIf="selectedCountry"
|
|
13055
13088
|
[src]="getFlagUrl(selectedCountry.flag)"
|
|
13056
|
-
class="h-4 w-6 rounded-sm border border-border object-cover
|
|
13057
|
-
[alt]="selectedCountry.name"
|
|
13058
|
-
/>
|
|
13089
|
+
class="h-4 w-6 flex-shrink-0 rounded-sm border border-border object-cover"
|
|
13090
|
+
[alt]="selectedCountry.name" />
|
|
13059
13091
|
<span *ngIf="selectedCountry && showName" class="truncate font-medium">
|
|
13060
13092
|
{{ selectedCountry.name }}
|
|
13061
13093
|
</span>
|
|
13062
|
-
<span *ngIf="!selectedCountry" class="text-muted-foreground
|
|
13094
|
+
<span *ngIf="!selectedCountry" class="truncate text-muted-foreground">
|
|
13063
13095
|
{{ placeholder }}
|
|
13064
13096
|
</span>
|
|
13065
13097
|
</div>
|
|
@@ -13067,16 +13099,16 @@ class CountrySelectorComponent {
|
|
|
13067
13099
|
</button>
|
|
13068
13100
|
</div>
|
|
13069
13101
|
|
|
13070
|
-
<div
|
|
13071
|
-
|
|
13102
|
+
<div
|
|
13103
|
+
class="flex min-w-[300px] max-w-[400px] flex-col overflow-hidden rounded-md border border-border bg-popover shadow-md">
|
|
13104
|
+
<div class="sticky top-0 z-10 border-b border-border bg-popover p-2 shadow-sm">
|
|
13072
13105
|
<tolle-input
|
|
13073
13106
|
size="sm"
|
|
13074
13107
|
placeholder="Search country..."
|
|
13075
13108
|
[(ngModel)]="searchQuery"
|
|
13076
13109
|
(ngModelChange)="filterCountries($event)"
|
|
13077
13110
|
class="w-full"
|
|
13078
|
-
#searchInput
|
|
13079
|
-
>
|
|
13111
|
+
#searchInput>
|
|
13080
13112
|
<i prefix class="ri-search-line"></i>
|
|
13081
13113
|
</tolle-input>
|
|
13082
13114
|
</div>
|
|
@@ -13085,20 +13117,22 @@ class CountrySelectorComponent {
|
|
|
13085
13117
|
<div
|
|
13086
13118
|
*ngFor="let country of shadowCountries"
|
|
13087
13119
|
(click)="selectCountry(country)"
|
|
13088
|
-
[class]="getItemClass(country)"
|
|
13089
|
-
|
|
13090
|
-
<div class="flex items-center gap-3 w-full">
|
|
13120
|
+
[class]="getItemClass(country)">
|
|
13121
|
+
<div class="flex w-full items-center gap-3">
|
|
13091
13122
|
<img
|
|
13092
13123
|
[src]="getFlagUrl(country.flag)"
|
|
13093
|
-
class="h-4 w-6 rounded-sm border border-border object-cover
|
|
13094
|
-
[alt]="country.name"
|
|
13095
|
-
|
|
13096
|
-
<span class="text-sm flex-1 truncate">{{ country.name }}</span>
|
|
13124
|
+
class="h-4 w-6 flex-shrink-0 rounded-sm border border-border object-cover"
|
|
13125
|
+
[alt]="country.name" />
|
|
13126
|
+
<span class="flex-1 truncate text-sm">{{ country.name }}</span>
|
|
13097
13127
|
<span class="text-xs text-muted-foreground">{{ country.dialCode }}</span>
|
|
13098
|
-
<i
|
|
13128
|
+
<i
|
|
13129
|
+
*ngIf="selectedCountry?.isoAlpha2 === country.isoAlpha2"
|
|
13130
|
+
class="ri-check-line text-primary"></i>
|
|
13099
13131
|
</div>
|
|
13100
13132
|
</div>
|
|
13101
|
-
<div
|
|
13133
|
+
<div
|
|
13134
|
+
*ngIf="shadowCountries.length === 0"
|
|
13135
|
+
class="py-6 text-center text-sm text-muted-foreground">
|
|
13102
13136
|
No countries found.
|
|
13103
13137
|
</div>
|
|
13104
13138
|
</div>
|
|
@@ -13108,16 +13142,14 @@ class CountrySelectorComponent {
|
|
|
13108
13142
|
<ng-container *ngIf="!disabled">
|
|
13109
13143
|
<p
|
|
13110
13144
|
*ngIf="hint && !error"
|
|
13111
|
-
class="text-xs text-muted-foreground
|
|
13112
|
-
[class.opacity-0]="isFocused && hideHintOnFocus"
|
|
13113
|
-
>
|
|
13145
|
+
class="px-1 text-xs text-muted-foreground transition-opacity duration-200"
|
|
13146
|
+
[class.opacity-0]="isFocused && hideHintOnFocus">
|
|
13114
13147
|
{{ hint }}
|
|
13115
13148
|
</p>
|
|
13116
13149
|
<p
|
|
13117
13150
|
*ngIf="error && errorMessage"
|
|
13118
13151
|
[id]="id + '-error'"
|
|
13119
|
-
class="
|
|
13120
|
-
>
|
|
13152
|
+
class="px-1 text-xs font-medium text-destructive">
|
|
13121
13153
|
{{ errorMessage }}
|
|
13122
13154
|
</p>
|
|
13123
13155
|
</ng-container>
|
|
@@ -13134,19 +13166,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
13134
13166
|
{
|
|
13135
13167
|
provide: NG_VALUE_ACCESSOR,
|
|
13136
13168
|
useExisting: forwardRef(() => CountrySelectorComponent),
|
|
13137
|
-
multi: true
|
|
13138
|
-
}
|
|
13169
|
+
multi: true,
|
|
13170
|
+
},
|
|
13139
13171
|
],
|
|
13140
13172
|
template: `
|
|
13141
|
-
<div class="flex flex-col gap-1.5
|
|
13142
|
-
<label
|
|
13143
|
-
*ngIf="label"
|
|
13144
|
-
[for]="id"
|
|
13145
|
-
[class]="computedLabelClass">
|
|
13173
|
+
<div class="flex w-full flex-col gap-1.5">
|
|
13174
|
+
<label *ngIf="label" [for]="id" [class]="computedLabelClass">
|
|
13146
13175
|
{{ label }}
|
|
13147
13176
|
</label>
|
|
13148
13177
|
|
|
13149
|
-
<tolle-popover
|
|
13178
|
+
<tolle-popover
|
|
13179
|
+
#popover
|
|
13180
|
+
[placement]="'bottom-start'"
|
|
13181
|
+
(onOpen)="onPopoverOpen()"
|
|
13182
|
+
(onClose)="onPopoverClose()">
|
|
13150
13183
|
<div trigger class="w-full">
|
|
13151
13184
|
<button
|
|
13152
13185
|
type="button"
|
|
@@ -13156,19 +13189,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
13156
13189
|
(blur)="onBlur()"
|
|
13157
13190
|
(focus)="onFocus()"
|
|
13158
13191
|
[attr.aria-invalid]="error"
|
|
13159
|
-
[attr.aria-describedby]="error && errorMessage ? id + '-error' : null"
|
|
13160
|
-
>
|
|
13192
|
+
[attr.aria-describedby]="error && errorMessage ? id + '-error' : null">
|
|
13161
13193
|
<div class="flex items-center gap-2 truncate">
|
|
13162
13194
|
<img
|
|
13163
13195
|
*ngIf="selectedCountry"
|
|
13164
13196
|
[src]="getFlagUrl(selectedCountry.flag)"
|
|
13165
|
-
class="h-4 w-6 rounded-sm border border-border object-cover
|
|
13166
|
-
[alt]="selectedCountry.name"
|
|
13167
|
-
/>
|
|
13197
|
+
class="h-4 w-6 flex-shrink-0 rounded-sm border border-border object-cover"
|
|
13198
|
+
[alt]="selectedCountry.name" />
|
|
13168
13199
|
<span *ngIf="selectedCountry && showName" class="truncate font-medium">
|
|
13169
13200
|
{{ selectedCountry.name }}
|
|
13170
13201
|
</span>
|
|
13171
|
-
<span *ngIf="!selectedCountry" class="text-muted-foreground
|
|
13202
|
+
<span *ngIf="!selectedCountry" class="truncate text-muted-foreground">
|
|
13172
13203
|
{{ placeholder }}
|
|
13173
13204
|
</span>
|
|
13174
13205
|
</div>
|
|
@@ -13176,16 +13207,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
13176
13207
|
</button>
|
|
13177
13208
|
</div>
|
|
13178
13209
|
|
|
13179
|
-
<div
|
|
13180
|
-
|
|
13210
|
+
<div
|
|
13211
|
+
class="flex min-w-[300px] max-w-[400px] flex-col overflow-hidden rounded-md border border-border bg-popover shadow-md">
|
|
13212
|
+
<div class="sticky top-0 z-10 border-b border-border bg-popover p-2 shadow-sm">
|
|
13181
13213
|
<tolle-input
|
|
13182
13214
|
size="sm"
|
|
13183
13215
|
placeholder="Search country..."
|
|
13184
13216
|
[(ngModel)]="searchQuery"
|
|
13185
13217
|
(ngModelChange)="filterCountries($event)"
|
|
13186
13218
|
class="w-full"
|
|
13187
|
-
#searchInput
|
|
13188
|
-
>
|
|
13219
|
+
#searchInput>
|
|
13189
13220
|
<i prefix class="ri-search-line"></i>
|
|
13190
13221
|
</tolle-input>
|
|
13191
13222
|
</div>
|
|
@@ -13194,20 +13225,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
13194
13225
|
<div
|
|
13195
13226
|
*ngFor="let country of shadowCountries"
|
|
13196
13227
|
(click)="selectCountry(country)"
|
|
13197
|
-
[class]="getItemClass(country)"
|
|
13198
|
-
|
|
13199
|
-
<div class="flex items-center gap-3 w-full">
|
|
13228
|
+
[class]="getItemClass(country)">
|
|
13229
|
+
<div class="flex w-full items-center gap-3">
|
|
13200
13230
|
<img
|
|
13201
13231
|
[src]="getFlagUrl(country.flag)"
|
|
13202
|
-
class="h-4 w-6 rounded-sm border border-border object-cover
|
|
13203
|
-
[alt]="country.name"
|
|
13204
|
-
|
|
13205
|
-
<span class="text-sm flex-1 truncate">{{ country.name }}</span>
|
|
13232
|
+
class="h-4 w-6 flex-shrink-0 rounded-sm border border-border object-cover"
|
|
13233
|
+
[alt]="country.name" />
|
|
13234
|
+
<span class="flex-1 truncate text-sm">{{ country.name }}</span>
|
|
13206
13235
|
<span class="text-xs text-muted-foreground">{{ country.dialCode }}</span>
|
|
13207
|
-
<i
|
|
13236
|
+
<i
|
|
13237
|
+
*ngIf="selectedCountry?.isoAlpha2 === country.isoAlpha2"
|
|
13238
|
+
class="ri-check-line text-primary"></i>
|
|
13208
13239
|
</div>
|
|
13209
13240
|
</div>
|
|
13210
|
-
<div
|
|
13241
|
+
<div
|
|
13242
|
+
*ngIf="shadowCountries.length === 0"
|
|
13243
|
+
class="py-6 text-center text-sm text-muted-foreground">
|
|
13211
13244
|
No countries found.
|
|
13212
13245
|
</div>
|
|
13213
13246
|
</div>
|
|
@@ -13217,21 +13250,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
13217
13250
|
<ng-container *ngIf="!disabled">
|
|
13218
13251
|
<p
|
|
13219
13252
|
*ngIf="hint && !error"
|
|
13220
|
-
class="text-xs text-muted-foreground
|
|
13221
|
-
[class.opacity-0]="isFocused && hideHintOnFocus"
|
|
13222
|
-
>
|
|
13253
|
+
class="px-1 text-xs text-muted-foreground transition-opacity duration-200"
|
|
13254
|
+
[class.opacity-0]="isFocused && hideHintOnFocus">
|
|
13223
13255
|
{{ hint }}
|
|
13224
13256
|
</p>
|
|
13225
13257
|
<p
|
|
13226
13258
|
*ngIf="error && errorMessage"
|
|
13227
13259
|
[id]="id + '-error'"
|
|
13228
|
-
class="
|
|
13229
|
-
>
|
|
13260
|
+
class="px-1 text-xs font-medium text-destructive">
|
|
13230
13261
|
{{ errorMessage }}
|
|
13231
13262
|
</p>
|
|
13232
13263
|
</ng-container>
|
|
13233
13264
|
</div>
|
|
13234
|
-
|
|
13265
|
+
`,
|
|
13235
13266
|
}]
|
|
13236
13267
|
}], propDecorators: { id: [{
|
|
13237
13268
|
type: Input
|
|
@@ -13266,6 +13297,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
13266
13297
|
}], popover: [{
|
|
13267
13298
|
type: ViewChild,
|
|
13268
13299
|
args: ['popover']
|
|
13300
|
+
}], searchInput: [{
|
|
13301
|
+
type: ViewChild,
|
|
13302
|
+
args: ['searchInput']
|
|
13269
13303
|
}] } });
|
|
13270
13304
|
|
|
13271
13305
|
class PhoneNumberInputComponent {
|