@open-rlb/ng-bootstrap 3.1.3 → 3.1.5
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.
|
@@ -5993,14 +5993,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
5993
5993
|
|
|
5994
5994
|
class OptionComponent {
|
|
5995
5995
|
constructor() {
|
|
5996
|
-
this.value = input
|
|
5996
|
+
this.value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
5997
5997
|
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
5998
5998
|
// 'template' is used by SelectComponent (contains <option> tag)
|
|
5999
5999
|
this.template = viewChild.required('element');
|
|
6000
6000
|
this.contentTemplate = viewChild.required('content');
|
|
6001
6001
|
}
|
|
6002
6002
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: OptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6003
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.5", type: OptionComponent, isStandalone: false, selector: "rlb-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired:
|
|
6003
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.5", type: OptionComponent, isStandalone: false, selector: "rlb-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "template", first: true, predicate: ["element"], descendants: true, isSignal: true }, { propertyName: "contentTemplate", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
6004
6004
|
<ng-template #content>
|
|
6005
6005
|
<ng-content></ng-content>
|
|
6006
6006
|
</ng-template>
|
|
@@ -6037,7 +6037,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
6037
6037
|
`,
|
|
6038
6038
|
standalone: false,
|
|
6039
6039
|
}]
|
|
6040
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required:
|
|
6040
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], template: [{ type: i0.ViewChild, args: ['element', { isSignal: true }] }], contentTemplate: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }] } });
|
|
6041
6041
|
|
|
6042
6042
|
const RLB_TRANSLATION_SERVICE = new InjectionToken('RLB_TRANSLATION_SERVICE_TOKEN');
|
|
6043
6043
|
|
|
@@ -6099,18 +6099,13 @@ class SelectComponent extends AbstractComponent {
|
|
|
6099
6099
|
this.control = control;
|
|
6100
6100
|
this.placeholder = input(undefined, { ...(ngDevMode ? { debugName: "placeholder" } : {}), alias: 'placeholder' });
|
|
6101
6101
|
this.size = input(undefined, { ...(ngDevMode ? { debugName: "size" } : {}), alias: 'size' });
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
alias: 'disabled',
|
|
6105
|
-
transform: booleanAttribute,
|
|
6106
|
-
});
|
|
6102
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), alias: 'disabled',
|
|
6103
|
+
transform: booleanAttribute });
|
|
6107
6104
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), alias: 'readonly', transform: booleanAttribute });
|
|
6108
6105
|
this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : {}), alias: 'multiple', transform: booleanAttribute });
|
|
6109
6106
|
this.display = input(undefined, { ...(ngDevMode ? { debugName: "display" } : {}), alias: 'display', transform: numberAttribute });
|
|
6110
|
-
this.userDefinedId = input('', {
|
|
6111
|
-
|
|
6112
|
-
transform: (v) => v || '',
|
|
6113
|
-
}); // Abstract expects InputSignal<string> strictly, but inference might vary
|
|
6107
|
+
this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : {}), alias: 'id',
|
|
6108
|
+
transform: (v) => v || '' });
|
|
6114
6109
|
this.enableValidation = input(false, { ...(ngDevMode ? { debugName: "enableValidation" } : {}), transform: booleanAttribute, alias: 'enable-validation' });
|
|
6115
6110
|
this.el = viewChild.required('select');
|
|
6116
6111
|
this._projectedDisplayOptions = viewChild('projectedDisplayOptions', { ...(ngDevMode ? { debugName: "_projectedDisplayOptions" } : {}), read: ViewContainerRef });
|
|
@@ -6464,9 +6459,7 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
6464
6459
|
this.suggestionsList = [];
|
|
6465
6460
|
this.activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
|
|
6466
6461
|
// COMMON INPUT/OUTPUT
|
|
6467
|
-
this.disabled = input(false, {
|
|
6468
|
-
transform: booleanAttribute,
|
|
6469
|
-
});
|
|
6462
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
6470
6463
|
this.isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : []));
|
|
6471
6464
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
6472
6465
|
this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : {}), transform: booleanAttribute });
|
|
@@ -6517,9 +6510,7 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
6517
6510
|
update(ev) {
|
|
6518
6511
|
const t = ev;
|
|
6519
6512
|
const inputValue = t?.value || '';
|
|
6520
|
-
const valueToPropagate = inputValue === ''
|
|
6521
|
-
? { text: '', value: '' }
|
|
6522
|
-
: { text: inputValue, value: inputValue };
|
|
6513
|
+
const valueToPropagate = inputValue === '' ? { text: '', value: '' } : { text: inputValue, value: inputValue };
|
|
6523
6514
|
this.setValue(valueToPropagate);
|
|
6524
6515
|
if (this.control && this.control.control) {
|
|
6525
6516
|
this.control.control.markAsDirty();
|
|
@@ -6581,8 +6572,7 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
6581
6572
|
this.setActiveItem(newIndex);
|
|
6582
6573
|
}
|
|
6583
6574
|
setActiveItem(index) {
|
|
6584
|
-
if (this.activeIndex() !== -1 &&
|
|
6585
|
-
this.dropdown.nativeElement.children[this.activeIndex()]) {
|
|
6575
|
+
if (this.activeIndex() !== -1 && this.dropdown.nativeElement.children[this.activeIndex()]) {
|
|
6586
6576
|
const oldItem = this.dropdown.nativeElement.children[this.activeIndex()];
|
|
6587
6577
|
this.renderer.removeClass(oldItem, 'active');
|
|
6588
6578
|
}
|
|
@@ -6644,7 +6634,7 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
6644
6634
|
if (!dropdown)
|
|
6645
6635
|
return;
|
|
6646
6636
|
this.clearDropdown();
|
|
6647
|
-
this.suggestionsList = suggestions.map(
|
|
6637
|
+
this.suggestionsList = suggestions.map(s => typeof s === 'string' ? { text: s, value: s } : s);
|
|
6648
6638
|
if (this.suggestionsList.length === 0) {
|
|
6649
6639
|
const el = this.renderer.createElement('a');
|
|
6650
6640
|
this.renderer.addClass(el, 'dropdown-item');
|
|
@@ -6657,7 +6647,7 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
6657
6647
|
const el = this.renderer.createElement('a');
|
|
6658
6648
|
this.renderer.addClass(el, 'dropdown-item');
|
|
6659
6649
|
this.renderer.appendChild(el, this.renderer.createText(item.text));
|
|
6660
|
-
this.renderer.listen(el, 'click',
|
|
6650
|
+
this.renderer.listen(el, 'click', ev => {
|
|
6661
6651
|
this.activeIndex.set(i);
|
|
6662
6652
|
this.selectActiveItem();
|
|
6663
6653
|
ev.stopPropagation();
|
|
@@ -6696,11 +6686,37 @@ function requiredAutocompleteValue() {
|
|
|
6696
6686
|
};
|
|
6697
6687
|
}
|
|
6698
6688
|
|
|
6699
|
-
class AutocompleteCountryDialCodeComponent extends
|
|
6700
|
-
|
|
6701
|
-
|
|
6689
|
+
class AutocompleteCountryDialCodeComponent extends AbstractComponent {
|
|
6690
|
+
onDocumentPointerDown(event) {
|
|
6691
|
+
this.handleOutsideEvent(event);
|
|
6692
|
+
}
|
|
6693
|
+
onEscape(event) {
|
|
6694
|
+
if (this.isOpen()) {
|
|
6695
|
+
this.closeDropdown();
|
|
6696
|
+
this.el()?.nativeElement?.blur();
|
|
6697
|
+
}
|
|
6698
|
+
}
|
|
6699
|
+
constructor(idService, hostRef, control) {
|
|
6700
|
+
super(idService, control);
|
|
6701
|
+
this.hostRef = hostRef;
|
|
6702
6702
|
this.control = control;
|
|
6703
|
+
// State
|
|
6704
|
+
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
6705
|
+
this.suggestions = signal([], ...(ngDevMode ? [{ debugName: "suggestions" }] : []));
|
|
6706
|
+
this.hasSuggestions = computed(() => this.suggestions().length > 0, ...(ngDevMode ? [{ debugName: "hasSuggestions" }] : []));
|
|
6707
|
+
// Inputs
|
|
6708
|
+
this.disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
6709
|
+
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
6710
|
+
this.placeholder = input('', { ...(ngDevMode ? { debugName: "placeholder" } : {}), alias: 'placeholder' });
|
|
6711
|
+
this.size = input(undefined, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
6712
|
+
this.maxHeight = input(200, { ...(ngDevMode ? { debugName: "maxHeight" } : {}), transform: numberAttribute, alias: 'max-height' });
|
|
6713
|
+
this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : {}), transform: booleanAttribute, alias: 'loading' });
|
|
6714
|
+
this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : {}), alias: 'id', transform: (v) => v || '' });
|
|
6703
6715
|
this.enableFlagIcons = input(true, { ...(ngDevMode ? { debugName: "enableFlagIcons" } : {}), transform: booleanAttribute, alias: 'enable-flag-icons' });
|
|
6716
|
+
// View Children
|
|
6717
|
+
this.el = viewChild('field', ...(ngDevMode ? [{ debugName: "el" }] : []));
|
|
6718
|
+
this.dropdown = viewChild('autocomplete', ...(ngDevMode ? [{ debugName: "dropdown" }] : []));
|
|
6719
|
+
this.selected = output();
|
|
6704
6720
|
this._countries = [
|
|
6705
6721
|
{
|
|
6706
6722
|
text: 'Afghanistan',
|
|
@@ -7919,47 +7935,105 @@ class AutocompleteCountryDialCodeComponent extends AbstractAutocompleteComponent
|
|
|
7919
7935
|
},
|
|
7920
7936
|
];
|
|
7921
7937
|
}
|
|
7922
|
-
|
|
7923
|
-
this.
|
|
7924
|
-
|
|
7938
|
+
update(ev) {
|
|
7939
|
+
if (this.typingTimeout)
|
|
7940
|
+
clearTimeout(this.typingTimeout);
|
|
7941
|
+
this.typingTimeout = setTimeout(() => {
|
|
7942
|
+
if (!this.disabled()) {
|
|
7943
|
+
const t = ev;
|
|
7944
|
+
this.manageSuggestions(t?.value);
|
|
7945
|
+
}
|
|
7946
|
+
}, 200);
|
|
7947
|
+
}
|
|
7948
|
+
onWrite(data) {
|
|
7949
|
+
const field = this.el();
|
|
7950
|
+
if (field && field.nativeElement) {
|
|
7951
|
+
if (typeof data === 'string') {
|
|
7952
|
+
const match = this._countries.find(c => c.value === data);
|
|
7953
|
+
field.nativeElement.value = match ? match.text : data;
|
|
7954
|
+
}
|
|
7955
|
+
else {
|
|
7956
|
+
field.nativeElement.value = data?.text || '';
|
|
7957
|
+
}
|
|
7958
|
+
}
|
|
7959
|
+
}
|
|
7960
|
+
getText(d) {
|
|
7961
|
+
if (!d)
|
|
7962
|
+
return '';
|
|
7963
|
+
if (typeof d === 'string') {
|
|
7964
|
+
const match = this._countries.find(c => c.value === d);
|
|
7965
|
+
return match ? match.text : d;
|
|
7966
|
+
}
|
|
7967
|
+
return d.text;
|
|
7968
|
+
}
|
|
7969
|
+
manageSuggestions(query) {
|
|
7970
|
+
this.suggestions.set([]);
|
|
7925
7971
|
if (query && query.length > 0) {
|
|
7926
7972
|
this.openDropdown();
|
|
7927
|
-
const
|
|
7928
|
-
|
|
7929
|
-
return _c.text.toLowerCase().startsWith(query.toLowerCase());
|
|
7930
|
-
});
|
|
7931
|
-
this.renderAc(suggestions);
|
|
7973
|
+
const rawSuggestions = this.getCountries().filter(c => c.text.toLowerCase().startsWith(query.toLowerCase()));
|
|
7974
|
+
this.suggestions.set(rawSuggestions);
|
|
7932
7975
|
}
|
|
7933
7976
|
else {
|
|
7934
7977
|
this.closeDropdown();
|
|
7935
7978
|
}
|
|
7936
7979
|
}
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7980
|
+
selectItem(item, ev) {
|
|
7981
|
+
ev?.stopPropagation();
|
|
7982
|
+
this.selected.emit(item);
|
|
7983
|
+
this.setValue(item);
|
|
7984
|
+
this.closeDropdown();
|
|
7985
|
+
}
|
|
7986
|
+
onEnter(ev) {
|
|
7987
|
+
const t = ev;
|
|
7988
|
+
if (!this.disabled() && t && t.value) {
|
|
7989
|
+
// Try to find exact match by name
|
|
7990
|
+
const match = this._countries.find(c => c.text.toLowerCase() === t.value.toLowerCase());
|
|
7991
|
+
const item = match || { text: t.value, value: t.value };
|
|
7992
|
+
this.setValue(item);
|
|
7993
|
+
this.closeDropdown();
|
|
7994
|
+
}
|
|
7995
|
+
}
|
|
7996
|
+
handleOutsideEvent(event) {
|
|
7997
|
+
if (!this.isOpen())
|
|
7998
|
+
return;
|
|
7999
|
+
const target = event.target;
|
|
8000
|
+
const dropdown = this.dropdown();
|
|
8001
|
+
const path = event.composedPath ? event.composedPath() : [];
|
|
8002
|
+
const clickedInsideHost = this.hostRef?.nativeElement?.contains(target);
|
|
8003
|
+
const clickedInsideDropdown = dropdown?.nativeElement?.contains
|
|
8004
|
+
? dropdown.nativeElement.contains(target)
|
|
8005
|
+
: false;
|
|
8006
|
+
const clickedInPath = path.length
|
|
8007
|
+
? path.some(p => p === this.hostRef.nativeElement || (dropdown && p === dropdown.nativeElement))
|
|
8008
|
+
: false;
|
|
8009
|
+
if (!(clickedInsideHost || clickedInsideDropdown || clickedInPath)) {
|
|
8010
|
+
this.closeDropdown();
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
openDropdown() {
|
|
8014
|
+
if (this.isOpen())
|
|
8015
|
+
return;
|
|
8016
|
+
this.isOpen.set(true);
|
|
8017
|
+
}
|
|
8018
|
+
closeDropdown() {
|
|
8019
|
+
if (!this.isOpen())
|
|
8020
|
+
return;
|
|
8021
|
+
this.isOpen.set(false);
|
|
7947
8022
|
}
|
|
7948
8023
|
getCountries() {
|
|
7949
8024
|
if (this.enableFlagIcons()) {
|
|
7950
|
-
return this._countries.map(country => {
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
});
|
|
8025
|
+
return this._countries.map(country => ({
|
|
8026
|
+
...country,
|
|
8027
|
+
// Using 'data' (ISO Code) for flag class
|
|
8028
|
+
iconClass: country.data ? `fi fi-${country.data.toLowerCase()}` : undefined,
|
|
8029
|
+
}));
|
|
7956
8030
|
}
|
|
7957
8031
|
else {
|
|
7958
8032
|
return this._countries;
|
|
7959
8033
|
}
|
|
7960
8034
|
}
|
|
7961
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteCountryDialCodeComponent, deps: [{ token: UniqueIdService }, { token: i0.
|
|
7962
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: AutocompleteCountryDialCodeComponent, isStandalone: false, selector: "rlb-autocomplete-country-dial-code", inputs: { enableFlagIcons: { classPropertyName: "enableFlagIcons", publicName: "enable-flag-icons", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
8035
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteCountryDialCodeComponent, deps: [{ token: UniqueIdService }, { token: i0.ElementRef }, { token: i2$2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8036
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: AutocompleteCountryDialCodeComponent, isStandalone: false, selector: "rlb-autocomplete-country-dial-code", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "max-height", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, enableFlagIcons: { classPropertyName: "enableFlagIcons", publicName: "enable-flag-icons", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", selected: "selected" }, host: { listeners: { "document:pointerdown": "onDocumentPointerDown($event)", "document:keydown.escape": "onEscape($event)" } }, viewQueries: [{ propertyName: "el", first: true, predicate: ["field"], descendants: true, isSignal: true }, { propertyName: "dropdown", first: true, predicate: ["autocomplete"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
7963
8037
|
<ng-content select="[before]"></ng-content>
|
|
7964
8038
|
<div class="input-group has-validation position-relative">
|
|
7965
8039
|
<input
|
|
@@ -7967,7 +8041,8 @@ class AutocompleteCountryDialCodeComponent extends AbstractAutocompleteComponent
|
|
|
7967
8041
|
[id]="id"
|
|
7968
8042
|
class="form-control"
|
|
7969
8043
|
type="text"
|
|
7970
|
-
[
|
|
8044
|
+
[value]="getText(value)"
|
|
8045
|
+
autocomplete="off"
|
|
7971
8046
|
[attr.disabled]="disabled() ? true : undefined"
|
|
7972
8047
|
[attr.readonly]="readonly() ? true : undefined"
|
|
7973
8048
|
[attr.placeholder]="placeholder()"
|
|
@@ -7979,23 +8054,47 @@ class AutocompleteCountryDialCodeComponent extends AbstractAutocompleteComponent
|
|
|
7979
8054
|
'is-valid': control?.touched && control?.valid,
|
|
7980
8055
|
}"
|
|
7981
8056
|
(input)="update($event.target)"
|
|
8057
|
+
(keyup.enter)="onEnter($event.target)"
|
|
7982
8058
|
/>
|
|
7983
8059
|
@if (errors() && showError()) {
|
|
7984
8060
|
<rlb-input-validation [errors]="errors()" />
|
|
7985
8061
|
}
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
8062
|
+
|
|
8063
|
+
<!-- Dropdown Logic -->
|
|
8064
|
+
@if (isOpen()) {
|
|
8065
|
+
<div
|
|
8066
|
+
#autocomplete
|
|
8067
|
+
class="dropdown-menu show w-100 position-absolute overflow-y-auto"
|
|
8068
|
+
[style.max-height.px]="maxHeight()"
|
|
8069
|
+
style="z-index: 1000; top: 100%;"
|
|
8070
|
+
>
|
|
8071
|
+
@if (!hasSuggestions()) {
|
|
8072
|
+
<a class="dropdown-item disabled text-center">No suggestions</a>
|
|
8073
|
+
} @else {
|
|
8074
|
+
@for (item of suggestions(); track item.value) {
|
|
8075
|
+
<a
|
|
8076
|
+
class="dropdown-item"
|
|
8077
|
+
(click)="selectItem(item, $event)"
|
|
8078
|
+
style="cursor: pointer"
|
|
8079
|
+
>
|
|
8080
|
+
@if (item.iconClass) {
|
|
8081
|
+
<i
|
|
8082
|
+
[class]="item.iconClass"
|
|
8083
|
+
class="me-2"
|
|
8084
|
+
></i>
|
|
8085
|
+
}
|
|
8086
|
+
<!-- Display Country Name and Dial Code -->
|
|
8087
|
+
{{ item.text }} ({{ item.value }})
|
|
8088
|
+
</a>
|
|
8089
|
+
}
|
|
8090
|
+
}
|
|
8091
|
+
</div>
|
|
8092
|
+
}
|
|
7994
8093
|
</div>
|
|
7995
|
-
@if (loading()
|
|
8094
|
+
@if (loading()) {
|
|
7996
8095
|
<rlb-progress
|
|
7997
8096
|
[height]="2"
|
|
7998
|
-
[infinite]="loading()
|
|
8097
|
+
[infinite]="loading()"
|
|
7999
8098
|
color="primary"
|
|
8000
8099
|
class="w-100"
|
|
8001
8100
|
/>
|
|
@@ -8015,7 +8114,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8015
8114
|
[id]="id"
|
|
8016
8115
|
class="form-control"
|
|
8017
8116
|
type="text"
|
|
8018
|
-
[
|
|
8117
|
+
[value]="getText(value)"
|
|
8118
|
+
autocomplete="off"
|
|
8019
8119
|
[attr.disabled]="disabled() ? true : undefined"
|
|
8020
8120
|
[attr.readonly]="readonly() ? true : undefined"
|
|
8021
8121
|
[attr.placeholder]="placeholder()"
|
|
@@ -8027,23 +8127,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8027
8127
|
'is-valid': control?.touched && control?.valid,
|
|
8028
8128
|
}"
|
|
8029
8129
|
(input)="update($event.target)"
|
|
8130
|
+
(keyup.enter)="onEnter($event.target)"
|
|
8030
8131
|
/>
|
|
8031
8132
|
@if (errors() && showError()) {
|
|
8032
8133
|
<rlb-input-validation [errors]="errors()" />
|
|
8033
8134
|
}
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8135
|
+
|
|
8136
|
+
<!-- Dropdown Logic -->
|
|
8137
|
+
@if (isOpen()) {
|
|
8138
|
+
<div
|
|
8139
|
+
#autocomplete
|
|
8140
|
+
class="dropdown-menu show w-100 position-absolute overflow-y-auto"
|
|
8141
|
+
[style.max-height.px]="maxHeight()"
|
|
8142
|
+
style="z-index: 1000; top: 100%;"
|
|
8143
|
+
>
|
|
8144
|
+
@if (!hasSuggestions()) {
|
|
8145
|
+
<a class="dropdown-item disabled text-center">No suggestions</a>
|
|
8146
|
+
} @else {
|
|
8147
|
+
@for (item of suggestions(); track item.value) {
|
|
8148
|
+
<a
|
|
8149
|
+
class="dropdown-item"
|
|
8150
|
+
(click)="selectItem(item, $event)"
|
|
8151
|
+
style="cursor: pointer"
|
|
8152
|
+
>
|
|
8153
|
+
@if (item.iconClass) {
|
|
8154
|
+
<i
|
|
8155
|
+
[class]="item.iconClass"
|
|
8156
|
+
class="me-2"
|
|
8157
|
+
></i>
|
|
8158
|
+
}
|
|
8159
|
+
<!-- Display Country Name and Dial Code -->
|
|
8160
|
+
{{ item.text }} ({{ item.value }})
|
|
8161
|
+
</a>
|
|
8162
|
+
}
|
|
8163
|
+
}
|
|
8164
|
+
</div>
|
|
8165
|
+
}
|
|
8042
8166
|
</div>
|
|
8043
|
-
@if (loading()
|
|
8167
|
+
@if (loading()) {
|
|
8044
8168
|
<rlb-progress
|
|
8045
8169
|
[height]="2"
|
|
8046
|
-
[infinite]="loading()
|
|
8170
|
+
[infinite]="loading()"
|
|
8047
8171
|
color="primary"
|
|
8048
8172
|
class="w-100"
|
|
8049
8173
|
/>
|
|
@@ -8052,20 +8176,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8052
8176
|
`,
|
|
8053
8177
|
standalone: false,
|
|
8054
8178
|
}]
|
|
8055
|
-
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.
|
|
8179
|
+
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.ElementRef }, { type: i2$2.NgControl, decorators: [{
|
|
8056
8180
|
type: Self
|
|
8057
8181
|
}, {
|
|
8058
8182
|
type: Optional
|
|
8059
|
-
}] }], propDecorators: { enableFlagIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-flag-icons", required: false }] }] } }
|
|
8183
|
+
}] }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "max-height", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], userDefinedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], enableFlagIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-flag-icons", required: false }] }], el: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }], dropdown: [{ type: i0.ViewChild, args: ['autocomplete', { isSignal: true }] }], selected: [{ type: i0.Output, args: ["selected"] }], onDocumentPointerDown: [{
|
|
8184
|
+
type: HostListener,
|
|
8185
|
+
args: ['document:pointerdown', ['$event']]
|
|
8186
|
+
}], onEscape: [{
|
|
8187
|
+
type: HostListener,
|
|
8188
|
+
args: ['document:keydown.escape', ['$event']]
|
|
8189
|
+
}] } });
|
|
8060
8190
|
|
|
8061
|
-
class AutocompleteCountryComponent extends
|
|
8062
|
-
|
|
8063
|
-
|
|
8191
|
+
class AutocompleteCountryComponent extends AbstractComponent {
|
|
8192
|
+
onDocumentPointerDown(event) {
|
|
8193
|
+
this.handleOutsideEvent(event);
|
|
8194
|
+
}
|
|
8195
|
+
onEscape(event) {
|
|
8196
|
+
if (this.isOpen()) {
|
|
8197
|
+
this.closeDropdown();
|
|
8198
|
+
this.el()?.nativeElement?.blur();
|
|
8199
|
+
}
|
|
8200
|
+
}
|
|
8201
|
+
constructor(idService, hostRef, control) {
|
|
8202
|
+
super(idService, control);
|
|
8203
|
+
this.hostRef = hostRef;
|
|
8064
8204
|
this.control = control;
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
this.
|
|
8068
|
-
|
|
8205
|
+
// State
|
|
8206
|
+
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
8207
|
+
this.suggestions = signal([], ...(ngDevMode ? [{ debugName: "suggestions" }] : []));
|
|
8208
|
+
this.hasSuggestions = computed(() => this.suggestions().length > 0, ...(ngDevMode ? [{ debugName: "hasSuggestions" }] : []));
|
|
8209
|
+
// Inputs
|
|
8210
|
+
this.disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
8211
|
+
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
8212
|
+
this.placeholder = input('', { ...(ngDevMode ? { debugName: "placeholder" } : {}), alias: 'placeholder' });
|
|
8213
|
+
this.size = input(undefined, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
8214
|
+
this.maxHeight = input(200, { ...(ngDevMode ? { debugName: "maxHeight" } : {}), transform: numberAttribute, alias: 'max-height' });
|
|
8215
|
+
this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : {}), alias: 'id', transform: (v) => v || '' });
|
|
8216
|
+
// Specific inputs for Country
|
|
8217
|
+
this.enableFlagIcons = input(false, { ...(ngDevMode ? { debugName: "enableFlagIcons" } : {}), transform: booleanAttribute, alias: 'enable-flag-icons' });
|
|
8218
|
+
this.enableValidation = input(false, { ...(ngDevMode ? { debugName: "enableValidation" } : {}), transform: booleanAttribute, alias: 'enable-validation' });
|
|
8219
|
+
// View Children
|
|
8220
|
+
this.el = viewChild('field', ...(ngDevMode ? [{ debugName: "el" }] : []));
|
|
8221
|
+
this.dropdown = viewChild('autocomplete', ...(ngDevMode ? [{ debugName: "dropdown" }] : []));
|
|
8222
|
+
this.selected = output();
|
|
8069
8223
|
this._countries = [
|
|
8070
8224
|
{ text: 'Afghanistan', value: 'AF' },
|
|
8071
8225
|
{ text: 'Albania', value: 'AL' },
|
|
@@ -8267,51 +8421,106 @@ class AutocompleteCountryComponent extends AbstractAutocompleteComponent {
|
|
|
8267
8421
|
{ text: 'Zimbabwe', value: 'ZW' },
|
|
8268
8422
|
];
|
|
8269
8423
|
}
|
|
8270
|
-
|
|
8271
|
-
this.
|
|
8272
|
-
|
|
8424
|
+
update(ev) {
|
|
8425
|
+
if (this.typingTimeout)
|
|
8426
|
+
clearTimeout(this.typingTimeout);
|
|
8427
|
+
this.typingTimeout = setTimeout(() => {
|
|
8428
|
+
if (!this.disabled()) {
|
|
8429
|
+
const t = ev;
|
|
8430
|
+
this.manageSuggestions(t?.value);
|
|
8431
|
+
}
|
|
8432
|
+
}, 200);
|
|
8433
|
+
}
|
|
8434
|
+
onWrite(data) {
|
|
8435
|
+
const field = this.el();
|
|
8436
|
+
if (field && field.nativeElement) {
|
|
8437
|
+
if (typeof data === 'string') {
|
|
8438
|
+
// Try to find the full object to display correct text
|
|
8439
|
+
const match = this._countries.find(c => c.value === data || c.text === data);
|
|
8440
|
+
field.nativeElement.value = match ? match.text : data;
|
|
8441
|
+
}
|
|
8442
|
+
else {
|
|
8443
|
+
field.nativeElement.value = data?.text || '';
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8446
|
+
}
|
|
8447
|
+
getText(d) {
|
|
8448
|
+
if (d == null)
|
|
8449
|
+
return '';
|
|
8450
|
+
if (typeof d === 'string') {
|
|
8451
|
+
const match = this._countries.find(c => c.value === d);
|
|
8452
|
+
return match ? match.text : d;
|
|
8453
|
+
}
|
|
8454
|
+
return d?.text;
|
|
8455
|
+
}
|
|
8456
|
+
manageSuggestions(query) {
|
|
8457
|
+
this.suggestions.set([]);
|
|
8273
8458
|
if (query && query.length > 0) {
|
|
8274
8459
|
this.openDropdown();
|
|
8275
|
-
const
|
|
8276
|
-
|
|
8277
|
-
return _c.text.toLowerCase().startsWith(query.toLowerCase());
|
|
8278
|
-
});
|
|
8279
|
-
this.renderAc(suggestions);
|
|
8460
|
+
const rawSuggestions = this.getCountries().filter(c => c.text.toLowerCase().startsWith(query.toLowerCase()));
|
|
8461
|
+
this.suggestions.set(rawSuggestions);
|
|
8280
8462
|
}
|
|
8281
8463
|
else {
|
|
8282
8464
|
this.closeDropdown();
|
|
8283
8465
|
}
|
|
8284
8466
|
}
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
:
|
|
8297
|
-
|
|
8298
|
-
|
|
8467
|
+
selectItem(item, ev) {
|
|
8468
|
+
ev?.stopPropagation();
|
|
8469
|
+
this.selected.emit(item);
|
|
8470
|
+
this.setValue(item);
|
|
8471
|
+
this.closeDropdown();
|
|
8472
|
+
}
|
|
8473
|
+
onEnter(ev) {
|
|
8474
|
+
const t = ev;
|
|
8475
|
+
if (!this.disabled() && t && t.value) {
|
|
8476
|
+
// Try to find exact match
|
|
8477
|
+
const match = this._countries.find(c => c.text.toLowerCase() === t.value.toLowerCase());
|
|
8478
|
+
const item = match || { text: t.value, value: t.value };
|
|
8479
|
+
this.setValue(item);
|
|
8480
|
+
this.closeDropdown();
|
|
8481
|
+
}
|
|
8299
8482
|
}
|
|
8483
|
+
handleOutsideEvent(event) {
|
|
8484
|
+
if (!this.isOpen())
|
|
8485
|
+
return;
|
|
8486
|
+
const target = event.target;
|
|
8487
|
+
const dropdown = this.dropdown();
|
|
8488
|
+
const path = event.composedPath ? event.composedPath() : [];
|
|
8489
|
+
const clickedInsideHost = this.hostRef?.nativeElement?.contains(target);
|
|
8490
|
+
const clickedInsideDropdown = dropdown?.nativeElement?.contains
|
|
8491
|
+
? dropdown.nativeElement.contains(target)
|
|
8492
|
+
: false;
|
|
8493
|
+
const clickedInPath = path.length
|
|
8494
|
+
? path.some(p => p === this.hostRef.nativeElement || (dropdown && p === dropdown.nativeElement))
|
|
8495
|
+
: false;
|
|
8496
|
+
if (!(clickedInsideHost || clickedInsideDropdown || clickedInPath)) {
|
|
8497
|
+
this.closeDropdown();
|
|
8498
|
+
}
|
|
8499
|
+
}
|
|
8500
|
+
openDropdown() {
|
|
8501
|
+
if (this.isOpen())
|
|
8502
|
+
return;
|
|
8503
|
+
this.isOpen.set(true);
|
|
8504
|
+
}
|
|
8505
|
+
closeDropdown() {
|
|
8506
|
+
if (!this.isOpen())
|
|
8507
|
+
return;
|
|
8508
|
+
this.isOpen.set(false);
|
|
8509
|
+
}
|
|
8510
|
+
// Data Logic
|
|
8300
8511
|
getCountries() {
|
|
8301
8512
|
if (this.enableFlagIcons()) {
|
|
8302
|
-
return this._countries.map(
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
};
|
|
8307
|
-
});
|
|
8513
|
+
return this._countries.map(country => ({
|
|
8514
|
+
...country,
|
|
8515
|
+
iconClass: `fi fi-${country.value.toLowerCase()}`,
|
|
8516
|
+
}));
|
|
8308
8517
|
}
|
|
8309
8518
|
else {
|
|
8310
8519
|
return this._countries;
|
|
8311
8520
|
}
|
|
8312
8521
|
}
|
|
8313
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteCountryComponent, deps: [{ token: UniqueIdService }, { token: i0.
|
|
8314
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: AutocompleteCountryComponent, isStandalone: false, selector: "rlb-autocomplete-country", inputs: { enableFlagIcons: { classPropertyName: "enableFlagIcons", publicName: "enable-flag-icons", isSignal: true, isRequired: false, transformFunction: null }, enableValidation: { classPropertyName: "enableValidation", publicName: "enable-validation", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
8522
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteCountryComponent, deps: [{ token: UniqueIdService }, { token: i0.ElementRef }, { token: i2$2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8523
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: AutocompleteCountryComponent, isStandalone: false, selector: "rlb-autocomplete-country", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "max-height", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, enableFlagIcons: { classPropertyName: "enableFlagIcons", publicName: "enable-flag-icons", isSignal: true, isRequired: false, transformFunction: null }, enableValidation: { classPropertyName: "enableValidation", publicName: "enable-validation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", selected: "selected" }, host: { listeners: { "document:pointerdown": "onDocumentPointerDown($event)", "document:keydown.escape": "onEscape($event)" } }, viewQueries: [{ propertyName: "el", first: true, predicate: ["field"], descendants: true, isSignal: true }, { propertyName: "dropdown", first: true, predicate: ["autocomplete"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
8315
8524
|
<ng-content select="[before]"></ng-content>
|
|
8316
8525
|
<div class="input-group has-validation position-relative">
|
|
8317
8526
|
<input
|
|
@@ -8319,7 +8528,8 @@ class AutocompleteCountryComponent extends AbstractAutocompleteComponent {
|
|
|
8319
8528
|
[id]="id"
|
|
8320
8529
|
class="form-control"
|
|
8321
8530
|
type="text"
|
|
8322
|
-
[
|
|
8531
|
+
[value]="getText(value)"
|
|
8532
|
+
autocomplete="off"
|
|
8323
8533
|
[attr.disabled]="disabled() ? true : undefined"
|
|
8324
8534
|
[attr.readonly]="readonly() ? true : undefined"
|
|
8325
8535
|
[attr.placeholder]="placeholder()"
|
|
@@ -8327,34 +8537,46 @@ class AutocompleteCountryComponent extends AbstractAutocompleteComponent {
|
|
|
8327
8537
|
[class.form-control-sm]="size() === 'small'"
|
|
8328
8538
|
(blur)="touch()"
|
|
8329
8539
|
[ngClass]="{
|
|
8330
|
-
'is-invalid':
|
|
8331
|
-
control?.touched && control?.invalid && enableValidation(),
|
|
8540
|
+
'is-invalid': control?.touched && control?.invalid && enableValidation(),
|
|
8332
8541
|
'is-valid': control?.touched && control?.valid && enableValidation(),
|
|
8333
8542
|
}"
|
|
8334
8543
|
(input)="update($event.target)"
|
|
8544
|
+
(keyup.enter)="onEnter($event.target)"
|
|
8335
8545
|
/>
|
|
8336
|
-
|
|
8337
|
-
|
|
8546
|
+
|
|
8547
|
+
<!-- Dropdown Logic -->
|
|
8548
|
+
@if (isOpen()) {
|
|
8549
|
+
<div
|
|
8550
|
+
#autocomplete
|
|
8551
|
+
class="dropdown-menu show w-100 position-absolute overflow-y-auto"
|
|
8552
|
+
[style.max-height.px]="maxHeight()"
|
|
8553
|
+
style="z-index: 1000; top: 100%;"
|
|
8554
|
+
>
|
|
8555
|
+
@if (!hasSuggestions()) {
|
|
8556
|
+
<a class="dropdown-item disabled text-center">No suggestions</a>
|
|
8557
|
+
} @else {
|
|
8558
|
+
@for (item of suggestions(); track item.value) {
|
|
8559
|
+
<a
|
|
8560
|
+
class="dropdown-item"
|
|
8561
|
+
(click)="selectItem(item, $event)"
|
|
8562
|
+
style="cursor: pointer"
|
|
8563
|
+
>
|
|
8564
|
+
<!-- Flag Icon Support -->
|
|
8565
|
+
@if (item.iconClass) {
|
|
8566
|
+
<i
|
|
8567
|
+
[class]="item.iconClass"
|
|
8568
|
+
class="me-2"
|
|
8569
|
+
></i>
|
|
8570
|
+
}
|
|
8571
|
+
{{ item.text }}
|
|
8572
|
+
</a>
|
|
8573
|
+
}
|
|
8574
|
+
}
|
|
8575
|
+
</div>
|
|
8338
8576
|
}
|
|
8339
|
-
<div
|
|
8340
|
-
#autocomplete
|
|
8341
|
-
[id]="id + '-ac'"
|
|
8342
|
-
class="dropdown-menu overflow-y-auto w-100 position-absolute"
|
|
8343
|
-
aria-labelledby="dropdownMenu"
|
|
8344
|
-
[style.max-height.px]="maxHeight()"
|
|
8345
|
-
style="z-index: 1000; top: 100%;"
|
|
8346
|
-
></div>
|
|
8347
8577
|
</div>
|
|
8348
|
-
@if (loading() || acLoading()) {
|
|
8349
|
-
<rlb-progress
|
|
8350
|
-
[height]="2"
|
|
8351
|
-
[infinite]="loading() || acLoading()"
|
|
8352
|
-
color="primary"
|
|
8353
|
-
class="w-100"
|
|
8354
|
-
/>
|
|
8355
|
-
}
|
|
8356
8578
|
<ng-content select="[after]"></ng-content>
|
|
8357
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }
|
|
8579
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
8358
8580
|
}
|
|
8359
8581
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteCountryComponent, decorators: [{
|
|
8360
8582
|
type: Component,
|
|
@@ -8368,7 +8590,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8368
8590
|
[id]="id"
|
|
8369
8591
|
class="form-control"
|
|
8370
8592
|
type="text"
|
|
8371
|
-
[
|
|
8593
|
+
[value]="getText(value)"
|
|
8594
|
+
autocomplete="off"
|
|
8372
8595
|
[attr.disabled]="disabled() ? true : undefined"
|
|
8373
8596
|
[attr.readonly]="readonly() ? true : undefined"
|
|
8374
8597
|
[attr.placeholder]="placeholder()"
|
|
@@ -8376,75 +8599,172 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8376
8599
|
[class.form-control-sm]="size() === 'small'"
|
|
8377
8600
|
(blur)="touch()"
|
|
8378
8601
|
[ngClass]="{
|
|
8379
|
-
'is-invalid':
|
|
8380
|
-
control?.touched && control?.invalid && enableValidation(),
|
|
8602
|
+
'is-invalid': control?.touched && control?.invalid && enableValidation(),
|
|
8381
8603
|
'is-valid': control?.touched && control?.valid && enableValidation(),
|
|
8382
8604
|
}"
|
|
8383
8605
|
(input)="update($event.target)"
|
|
8606
|
+
(keyup.enter)="onEnter($event.target)"
|
|
8384
8607
|
/>
|
|
8385
|
-
|
|
8386
|
-
|
|
8608
|
+
|
|
8609
|
+
<!-- Dropdown Logic -->
|
|
8610
|
+
@if (isOpen()) {
|
|
8611
|
+
<div
|
|
8612
|
+
#autocomplete
|
|
8613
|
+
class="dropdown-menu show w-100 position-absolute overflow-y-auto"
|
|
8614
|
+
[style.max-height.px]="maxHeight()"
|
|
8615
|
+
style="z-index: 1000; top: 100%;"
|
|
8616
|
+
>
|
|
8617
|
+
@if (!hasSuggestions()) {
|
|
8618
|
+
<a class="dropdown-item disabled text-center">No suggestions</a>
|
|
8619
|
+
} @else {
|
|
8620
|
+
@for (item of suggestions(); track item.value) {
|
|
8621
|
+
<a
|
|
8622
|
+
class="dropdown-item"
|
|
8623
|
+
(click)="selectItem(item, $event)"
|
|
8624
|
+
style="cursor: pointer"
|
|
8625
|
+
>
|
|
8626
|
+
<!-- Flag Icon Support -->
|
|
8627
|
+
@if (item.iconClass) {
|
|
8628
|
+
<i
|
|
8629
|
+
[class]="item.iconClass"
|
|
8630
|
+
class="me-2"
|
|
8631
|
+
></i>
|
|
8632
|
+
}
|
|
8633
|
+
{{ item.text }}
|
|
8634
|
+
</a>
|
|
8635
|
+
}
|
|
8636
|
+
}
|
|
8637
|
+
</div>
|
|
8387
8638
|
}
|
|
8388
|
-
<div
|
|
8389
|
-
#autocomplete
|
|
8390
|
-
[id]="id + '-ac'"
|
|
8391
|
-
class="dropdown-menu overflow-y-auto w-100 position-absolute"
|
|
8392
|
-
aria-labelledby="dropdownMenu"
|
|
8393
|
-
[style.max-height.px]="maxHeight()"
|
|
8394
|
-
style="z-index: 1000; top: 100%;"
|
|
8395
|
-
></div>
|
|
8396
8639
|
</div>
|
|
8397
|
-
@if (loading() || acLoading()) {
|
|
8398
|
-
<rlb-progress
|
|
8399
|
-
[height]="2"
|
|
8400
|
-
[infinite]="loading() || acLoading()"
|
|
8401
|
-
color="primary"
|
|
8402
|
-
class="w-100"
|
|
8403
|
-
/>
|
|
8404
|
-
}
|
|
8405
8640
|
<ng-content select="[after]"></ng-content>
|
|
8406
8641
|
`,
|
|
8407
8642
|
standalone: false,
|
|
8408
8643
|
}]
|
|
8409
|
-
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.
|
|
8644
|
+
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.ElementRef }, { type: i2$2.NgControl, decorators: [{
|
|
8410
8645
|
type: Self
|
|
8411
8646
|
}, {
|
|
8412
8647
|
type: Optional
|
|
8413
|
-
}] }], propDecorators: { enableFlagIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-flag-icons", required: false }] }], enableValidation: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-validation", required: false }] }] } }
|
|
8648
|
+
}] }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "max-height", required: false }] }], userDefinedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], enableFlagIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-flag-icons", required: false }] }], enableValidation: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-validation", required: false }] }], el: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }], dropdown: [{ type: i0.ViewChild, args: ['autocomplete', { isSignal: true }] }], selected: [{ type: i0.Output, args: ["selected"] }], onDocumentPointerDown: [{
|
|
8649
|
+
type: HostListener,
|
|
8650
|
+
args: ['document:pointerdown', ['$event']]
|
|
8651
|
+
}], onEscape: [{
|
|
8652
|
+
type: HostListener,
|
|
8653
|
+
args: ['document:keydown.escape', ['$event']]
|
|
8654
|
+
}] } });
|
|
8414
8655
|
|
|
8415
|
-
class AutocompleteTimezonesComponent extends
|
|
8416
|
-
|
|
8417
|
-
|
|
8656
|
+
class AutocompleteTimezonesComponent extends AbstractComponent {
|
|
8657
|
+
onDocumentPointerDown(event) {
|
|
8658
|
+
this.handleOutsideEvent(event);
|
|
8659
|
+
}
|
|
8660
|
+
onEscape(event) {
|
|
8661
|
+
if (this.isOpen()) {
|
|
8662
|
+
this.closeDropdown();
|
|
8663
|
+
this.el()?.nativeElement?.blur();
|
|
8664
|
+
}
|
|
8665
|
+
}
|
|
8666
|
+
constructor(idService, hostRef, control) {
|
|
8667
|
+
super(idService, control);
|
|
8668
|
+
this.hostRef = hostRef;
|
|
8418
8669
|
this.control = control;
|
|
8419
|
-
|
|
8420
|
-
|
|
8670
|
+
// State
|
|
8671
|
+
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
8672
|
+
this.suggestions = signal([], ...(ngDevMode ? [{ debugName: "suggestions" }] : []));
|
|
8673
|
+
this.hasSuggestions = computed(() => this.suggestions().length > 0, ...(ngDevMode ? [{ debugName: "hasSuggestions" }] : []));
|
|
8674
|
+
// Inputs
|
|
8675
|
+
this.disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
8676
|
+
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
8677
|
+
this.placeholder = input('', { ...(ngDevMode ? { debugName: "placeholder" } : {}), alias: 'placeholder' });
|
|
8678
|
+
this.size = input(undefined, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
8679
|
+
this.maxHeight = input(200, { ...(ngDevMode ? { debugName: "maxHeight" } : {}), transform: numberAttribute, alias: 'max-height' });
|
|
8680
|
+
this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : {}), transform: booleanAttribute, alias: 'loading' });
|
|
8681
|
+
this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : {}), alias: 'id', transform: (v) => v || '' });
|
|
8682
|
+
this.enableFlagIcons = input(false, { ...(ngDevMode ? { debugName: "enableFlagIcons" } : {}), transform: booleanAttribute, alias: 'enable-flag-icons' });
|
|
8683
|
+
// View Children
|
|
8684
|
+
this.el = viewChild('field', ...(ngDevMode ? [{ debugName: "el" }] : []));
|
|
8685
|
+
this.dropdown = viewChild('autocomplete', ...(ngDevMode ? [{ debugName: "dropdown" }] : []));
|
|
8686
|
+
this.selected = output();
|
|
8421
8687
|
}
|
|
8422
|
-
|
|
8423
|
-
this.
|
|
8424
|
-
|
|
8688
|
+
update(ev) {
|
|
8689
|
+
if (this.typingTimeout)
|
|
8690
|
+
clearTimeout(this.typingTimeout);
|
|
8691
|
+
this.typingTimeout = setTimeout(() => {
|
|
8692
|
+
if (!this.disabled()) {
|
|
8693
|
+
const t = ev;
|
|
8694
|
+
this.manageSuggestions(t?.value);
|
|
8695
|
+
}
|
|
8696
|
+
}, 200);
|
|
8697
|
+
}
|
|
8698
|
+
onWrite(data) {
|
|
8699
|
+
const field = this.el();
|
|
8700
|
+
if (field && field.nativeElement) {
|
|
8701
|
+
// Timezones are simple strings, so we just set the value
|
|
8702
|
+
field.nativeElement.value = data || '';
|
|
8703
|
+
}
|
|
8704
|
+
}
|
|
8705
|
+
manageSuggestions(query) {
|
|
8706
|
+
this.suggestions.set([]);
|
|
8425
8707
|
if (query && query.length > 0) {
|
|
8426
8708
|
this.openDropdown();
|
|
8427
8709
|
const timezones = DateTz.timezones();
|
|
8428
|
-
const
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8710
|
+
const filtered = timezones.filter(tz => tz.toLowerCase().includes(query.toLowerCase()));
|
|
8711
|
+
// Map string[] to AutocompleteItem[] for the template
|
|
8712
|
+
this.suggestions.set(filtered.map(tz => ({
|
|
8713
|
+
text: tz,
|
|
8714
|
+
value: tz,
|
|
8715
|
+
})));
|
|
8432
8716
|
}
|
|
8433
8717
|
else {
|
|
8434
8718
|
this.closeDropdown();
|
|
8435
8719
|
}
|
|
8436
8720
|
}
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8721
|
+
selectItem(item, ev) {
|
|
8722
|
+
ev?.stopPropagation();
|
|
8723
|
+
const val = item.value;
|
|
8724
|
+
this.selected.emit(val);
|
|
8725
|
+
this.setValue(val);
|
|
8726
|
+
this.closeDropdown();
|
|
8727
|
+
const field = this.el();
|
|
8728
|
+
if (field?.nativeElement) {
|
|
8729
|
+
field.nativeElement.value = val;
|
|
8440
8730
|
}
|
|
8441
|
-
|
|
8442
|
-
|
|
8731
|
+
}
|
|
8732
|
+
onEnter(ev) {
|
|
8733
|
+
const t = ev;
|
|
8734
|
+
if (!this.disabled() && t && t.value) {
|
|
8735
|
+
this.setValue(t.value);
|
|
8736
|
+
this.closeDropdown();
|
|
8737
|
+
}
|
|
8738
|
+
}
|
|
8739
|
+
handleOutsideEvent(event) {
|
|
8740
|
+
if (!this.isOpen())
|
|
8741
|
+
return;
|
|
8742
|
+
const target = event.target;
|
|
8743
|
+
const dropdown = this.dropdown();
|
|
8744
|
+
const path = event.composedPath ? event.composedPath() : [];
|
|
8745
|
+
const clickedInsideHost = this.hostRef?.nativeElement?.contains(target);
|
|
8746
|
+
const clickedInsideDropdown = dropdown?.nativeElement?.contains
|
|
8747
|
+
? dropdown.nativeElement.contains(target)
|
|
8748
|
+
: false;
|
|
8749
|
+
const clickedInPath = path.length
|
|
8750
|
+
? path.some(p => p === this.hostRef.nativeElement || (dropdown && p === dropdown.nativeElement))
|
|
8751
|
+
: false;
|
|
8752
|
+
if (!(clickedInsideHost || clickedInsideDropdown || clickedInPath)) {
|
|
8753
|
+
this.closeDropdown();
|
|
8443
8754
|
}
|
|
8444
|
-
return '';
|
|
8445
8755
|
}
|
|
8446
|
-
|
|
8447
|
-
|
|
8756
|
+
openDropdown() {
|
|
8757
|
+
if (this.isOpen())
|
|
8758
|
+
return;
|
|
8759
|
+
this.isOpen.set(true);
|
|
8760
|
+
}
|
|
8761
|
+
closeDropdown() {
|
|
8762
|
+
if (!this.isOpen())
|
|
8763
|
+
return;
|
|
8764
|
+
this.isOpen.set(false);
|
|
8765
|
+
}
|
|
8766
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteTimezonesComponent, deps: [{ token: UniqueIdService }, { token: i0.ElementRef }, { token: i2$2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8767
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: AutocompleteTimezonesComponent, isStandalone: false, selector: "rlb-autocomplete-timezones", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "max-height", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, enableFlagIcons: { classPropertyName: "enableFlagIcons", publicName: "enable-flag-icons", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", selected: "selected" }, host: { listeners: { "document:pointerdown": "onDocumentPointerDown($event)", "document:keydown.escape": "onEscape($event)" } }, viewQueries: [{ propertyName: "el", first: true, predicate: ["field"], descendants: true, isSignal: true }, { propertyName: "dropdown", first: true, predicate: ["autocomplete"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
8448
8768
|
<ng-content select="[before]"></ng-content>
|
|
8449
8769
|
<div class="input-group has-validation position-relative">
|
|
8450
8770
|
<input
|
|
@@ -8452,10 +8772,11 @@ class AutocompleteTimezonesComponent extends AbstractAutocompleteComponent {
|
|
|
8452
8772
|
[id]="id"
|
|
8453
8773
|
class="form-control"
|
|
8454
8774
|
type="text"
|
|
8775
|
+
[value]="value || ''"
|
|
8776
|
+
autocomplete="off"
|
|
8455
8777
|
[attr.disabled]="disabled() ? true : undefined"
|
|
8456
8778
|
[attr.readonly]="readonly() ? true : undefined"
|
|
8457
8779
|
[attr.placeholder]="placeholder()"
|
|
8458
|
-
[attr.autocomplete]="'off'"
|
|
8459
8780
|
[class.form-control-lg]="size() === 'large'"
|
|
8460
8781
|
[class.form-control-sm]="size() === 'small'"
|
|
8461
8782
|
(blur)="touch()"
|
|
@@ -8464,23 +8785,46 @@ class AutocompleteTimezonesComponent extends AbstractAutocompleteComponent {
|
|
|
8464
8785
|
'is-valid': control?.touched && control?.valid,
|
|
8465
8786
|
}"
|
|
8466
8787
|
(input)="update($event.target)"
|
|
8788
|
+
(keyup.enter)="onEnter($event.target)"
|
|
8467
8789
|
/>
|
|
8468
8790
|
@if (errors() && showError()) {
|
|
8469
8791
|
<rlb-input-validation [errors]="errors()" />
|
|
8470
8792
|
}
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8793
|
+
|
|
8794
|
+
<!-- Dropdown Logic -->
|
|
8795
|
+
@if (isOpen()) {
|
|
8796
|
+
<div
|
|
8797
|
+
#autocomplete
|
|
8798
|
+
class="dropdown-menu show w-100 position-absolute overflow-y-auto"
|
|
8799
|
+
[style.max-height.px]="maxHeight()"
|
|
8800
|
+
style="z-index: 1000; top: 100%;"
|
|
8801
|
+
>
|
|
8802
|
+
@if (!hasSuggestions()) {
|
|
8803
|
+
<a class="dropdown-item disabled text-center">No suggestions</a>
|
|
8804
|
+
} @else {
|
|
8805
|
+
@for (item of suggestions(); track item.value) {
|
|
8806
|
+
<a
|
|
8807
|
+
class="dropdown-item"
|
|
8808
|
+
(click)="selectItem(item, $event)"
|
|
8809
|
+
style="cursor: pointer"
|
|
8810
|
+
>
|
|
8811
|
+
@if (item.iconClass) {
|
|
8812
|
+
<i
|
|
8813
|
+
[class]="item.iconClass"
|
|
8814
|
+
class="me-2"
|
|
8815
|
+
></i>
|
|
8816
|
+
}
|
|
8817
|
+
{{ item.text }}
|
|
8818
|
+
</a>
|
|
8819
|
+
}
|
|
8820
|
+
}
|
|
8821
|
+
</div>
|
|
8822
|
+
}
|
|
8479
8823
|
</div>
|
|
8480
|
-
@if (loading()
|
|
8824
|
+
@if (loading()) {
|
|
8481
8825
|
<rlb-progress
|
|
8482
8826
|
[height]="2"
|
|
8483
|
-
[infinite]="loading()
|
|
8827
|
+
[infinite]="loading()"
|
|
8484
8828
|
color="primary"
|
|
8485
8829
|
class="w-100"
|
|
8486
8830
|
/>
|
|
@@ -8500,10 +8844,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8500
8844
|
[id]="id"
|
|
8501
8845
|
class="form-control"
|
|
8502
8846
|
type="text"
|
|
8847
|
+
[value]="value || ''"
|
|
8848
|
+
autocomplete="off"
|
|
8503
8849
|
[attr.disabled]="disabled() ? true : undefined"
|
|
8504
8850
|
[attr.readonly]="readonly() ? true : undefined"
|
|
8505
8851
|
[attr.placeholder]="placeholder()"
|
|
8506
|
-
[attr.autocomplete]="'off'"
|
|
8507
8852
|
[class.form-control-lg]="size() === 'large'"
|
|
8508
8853
|
[class.form-control-sm]="size() === 'small'"
|
|
8509
8854
|
(blur)="touch()"
|
|
@@ -8512,23 +8857,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8512
8857
|
'is-valid': control?.touched && control?.valid,
|
|
8513
8858
|
}"
|
|
8514
8859
|
(input)="update($event.target)"
|
|
8860
|
+
(keyup.enter)="onEnter($event.target)"
|
|
8515
8861
|
/>
|
|
8516
8862
|
@if (errors() && showError()) {
|
|
8517
8863
|
<rlb-input-validation [errors]="errors()" />
|
|
8518
8864
|
}
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8865
|
+
|
|
8866
|
+
<!-- Dropdown Logic -->
|
|
8867
|
+
@if (isOpen()) {
|
|
8868
|
+
<div
|
|
8869
|
+
#autocomplete
|
|
8870
|
+
class="dropdown-menu show w-100 position-absolute overflow-y-auto"
|
|
8871
|
+
[style.max-height.px]="maxHeight()"
|
|
8872
|
+
style="z-index: 1000; top: 100%;"
|
|
8873
|
+
>
|
|
8874
|
+
@if (!hasSuggestions()) {
|
|
8875
|
+
<a class="dropdown-item disabled text-center">No suggestions</a>
|
|
8876
|
+
} @else {
|
|
8877
|
+
@for (item of suggestions(); track item.value) {
|
|
8878
|
+
<a
|
|
8879
|
+
class="dropdown-item"
|
|
8880
|
+
(click)="selectItem(item, $event)"
|
|
8881
|
+
style="cursor: pointer"
|
|
8882
|
+
>
|
|
8883
|
+
@if (item.iconClass) {
|
|
8884
|
+
<i
|
|
8885
|
+
[class]="item.iconClass"
|
|
8886
|
+
class="me-2"
|
|
8887
|
+
></i>
|
|
8888
|
+
}
|
|
8889
|
+
{{ item.text }}
|
|
8890
|
+
</a>
|
|
8891
|
+
}
|
|
8892
|
+
}
|
|
8893
|
+
</div>
|
|
8894
|
+
}
|
|
8527
8895
|
</div>
|
|
8528
|
-
@if (loading()
|
|
8896
|
+
@if (loading()) {
|
|
8529
8897
|
<rlb-progress
|
|
8530
8898
|
[height]="2"
|
|
8531
|
-
[infinite]="loading()
|
|
8899
|
+
[infinite]="loading()"
|
|
8532
8900
|
color="primary"
|
|
8533
8901
|
class="w-100"
|
|
8534
8902
|
/>
|
|
@@ -8537,11 +8905,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8537
8905
|
`,
|
|
8538
8906
|
standalone: false,
|
|
8539
8907
|
}]
|
|
8540
|
-
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.
|
|
8908
|
+
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.ElementRef }, { type: i2$2.NgControl, decorators: [{
|
|
8541
8909
|
type: Self
|
|
8542
8910
|
}, {
|
|
8543
8911
|
type: Optional
|
|
8544
|
-
}] }], propDecorators: { enableFlagIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-flag-icons", required: false }] }] } }
|
|
8912
|
+
}] }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "max-height", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], userDefinedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], enableFlagIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-flag-icons", required: false }] }], el: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }], dropdown: [{ type: i0.ViewChild, args: ['autocomplete', { isSignal: true }] }], selected: [{ type: i0.Output, args: ["selected"] }], onDocumentPointerDown: [{
|
|
8913
|
+
type: HostListener,
|
|
8914
|
+
args: ['document:pointerdown', ['$event']]
|
|
8915
|
+
}], onEscape: [{
|
|
8916
|
+
type: HostListener,
|
|
8917
|
+
args: ['document:keydown.escape', ['$event']]
|
|
8918
|
+
}] } });
|
|
8545
8919
|
|
|
8546
8920
|
class AutocompleteComponent extends AbstractComponent {
|
|
8547
8921
|
onDocumentPointerDown(event) {
|
|
@@ -8553,19 +8927,22 @@ class AutocompleteComponent extends AbstractComponent {
|
|
|
8553
8927
|
this.el()?.nativeElement?.blur();
|
|
8554
8928
|
}
|
|
8555
8929
|
}
|
|
8556
|
-
constructor(idService,
|
|
8930
|
+
constructor(idService, hostRef, control) {
|
|
8557
8931
|
super(idService, control);
|
|
8558
|
-
this.renderer = renderer;
|
|
8559
8932
|
this.hostRef = hostRef;
|
|
8560
8933
|
this.control = control;
|
|
8561
8934
|
this.acLoading = signal(false, ...(ngDevMode ? [{ debugName: "acLoading" }] : []));
|
|
8935
|
+
// State
|
|
8562
8936
|
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
8937
|
+
this.suggestions = signal([], ...(ngDevMode ? [{ debugName: "suggestions" }] : []));
|
|
8938
|
+
this.hasSuggestions = computed(() => this.suggestions().length > 0, ...(ngDevMode ? [{ debugName: "hasSuggestions" }] : []));
|
|
8939
|
+
// Inputs
|
|
8563
8940
|
this.disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
8564
8941
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute, alias: 'readonly' });
|
|
8565
8942
|
this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : {}), transform: booleanAttribute, alias: 'loading' });
|
|
8566
8943
|
this.maxHeight = input(200, { ...(ngDevMode ? { debugName: "maxHeight" } : {}), transform: numberAttribute, alias: 'max-height' });
|
|
8567
8944
|
this.placeholder = input('', { ...(ngDevMode ? { debugName: "placeholder" } : {}), alias: 'placeholder' });
|
|
8568
|
-
this.autocomplete = input(() =>
|
|
8945
|
+
this.autocomplete = input(() => [], { ...(ngDevMode ? { debugName: "autocomplete" } : {}), alias: 'autocomplete' });
|
|
8569
8946
|
this.type = input('text', { ...(ngDevMode ? { debugName: "type" } : {}), alias: 'type' });
|
|
8570
8947
|
this.size = input(undefined, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
8571
8948
|
this.charsToSearch = input(3, { ...(ngDevMode ? { debugName: "charsToSearch" } : {}), alias: 'chars-to-search', transform: numberAttribute });
|
|
@@ -8595,83 +8972,63 @@ class AutocompleteComponent extends AbstractComponent {
|
|
|
8595
8972
|
field.nativeElement.value = data;
|
|
8596
8973
|
}
|
|
8597
8974
|
else {
|
|
8598
|
-
field.nativeElement.value = data?.text;
|
|
8975
|
+
field.nativeElement.value = data?.text || '';
|
|
8599
8976
|
}
|
|
8600
8977
|
}
|
|
8601
8978
|
}
|
|
8602
8979
|
manageSuggestions(data) {
|
|
8603
|
-
|
|
8980
|
+
// 1. Reset suggestions but keep dropdown state logic clean
|
|
8981
|
+
this.suggestions.set([]);
|
|
8604
8982
|
if (data && data.length >= this.charsToSearch()) {
|
|
8605
8983
|
this.openDropdown();
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8984
|
+
try {
|
|
8985
|
+
const result = this.autocomplete()(data);
|
|
8986
|
+
if (result instanceof Promise) {
|
|
8987
|
+
this.acLoading.set(true);
|
|
8988
|
+
result
|
|
8989
|
+
.then(s => this.handleResults(s))
|
|
8990
|
+
.catch(() => this.handleResults([]))
|
|
8991
|
+
.finally(() => this.acLoading.set(false));
|
|
8992
|
+
}
|
|
8993
|
+
else if (result instanceof Observable) {
|
|
8994
|
+
this.acLoading.set(true);
|
|
8995
|
+
lastValueFrom(result)
|
|
8996
|
+
.then(s => this.handleResults(s))
|
|
8997
|
+
.catch(() => this.handleResults([]))
|
|
8998
|
+
.finally(() => this.acLoading.set(false));
|
|
8999
|
+
}
|
|
9000
|
+
else {
|
|
9001
|
+
this.handleResults(result);
|
|
9002
|
+
}
|
|
8614
9003
|
}
|
|
8615
|
-
|
|
8616
|
-
|
|
9004
|
+
catch (e) {
|
|
9005
|
+
console.error('Error executing autocomplete function:', e);
|
|
9006
|
+
this.closeDropdown();
|
|
8617
9007
|
}
|
|
8618
9008
|
}
|
|
8619
9009
|
else {
|
|
8620
9010
|
this.closeDropdown();
|
|
8621
9011
|
}
|
|
8622
9012
|
}
|
|
8623
|
-
|
|
8624
|
-
const
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
this.renderer.addClass(el, 'text-center');
|
|
8633
|
-
this.renderer.setAttribute(el, 'disabled', 'true');
|
|
8634
|
-
this.renderer.appendChild(el, this.renderer.createText('No suggestions'));
|
|
8635
|
-
this.renderer.appendChild(dropdown.nativeElement, el);
|
|
8636
|
-
return;
|
|
8637
|
-
}
|
|
8638
|
-
for (const suggestion of suggestions) {
|
|
8639
|
-
const itemData = typeof suggestion === 'string'
|
|
8640
|
-
? { text: suggestion, value: suggestion }
|
|
8641
|
-
: suggestion;
|
|
8642
|
-
const el = this.renderer.createElement('a');
|
|
8643
|
-
this.renderer.addClass(el, 'dropdown-item');
|
|
8644
|
-
if (itemData.iconClass) {
|
|
8645
|
-
const icon = this.renderer.createElement('i');
|
|
8646
|
-
const classes = itemData.iconClass.split(/\s+/);
|
|
8647
|
-
for (const cls of classes) {
|
|
8648
|
-
if (cls) {
|
|
8649
|
-
this.renderer.addClass(icon, cls);
|
|
8650
|
-
}
|
|
8651
|
-
}
|
|
8652
|
-
this.renderer.addClass(icon, 'me-2');
|
|
8653
|
-
this.renderer.appendChild(el, icon);
|
|
8654
|
-
}
|
|
8655
|
-
this.renderer.appendChild(el, this.renderer.createText(itemData.text));
|
|
8656
|
-
this.renderer.listen(el, 'click', (ev) => {
|
|
8657
|
-
this.selected.emit(itemData);
|
|
8658
|
-
this.setValue(itemData);
|
|
8659
|
-
this.closeDropdown();
|
|
8660
|
-
ev.stopPropagation();
|
|
8661
|
-
});
|
|
8662
|
-
this.renderer.appendChild(dropdown.nativeElement, el);
|
|
8663
|
-
}
|
|
9013
|
+
handleResults(raw) {
|
|
9014
|
+
const normalize = raw.map(r => (typeof r === 'string' ? { text: r, value: r } : r));
|
|
9015
|
+
this.suggestions.set(normalize);
|
|
9016
|
+
}
|
|
9017
|
+
selectItem(item, ev) {
|
|
9018
|
+
ev?.stopPropagation();
|
|
9019
|
+
this.selected.emit(item);
|
|
9020
|
+
this.setValue(item);
|
|
9021
|
+
this.closeDropdown();
|
|
8664
9022
|
}
|
|
8665
9023
|
onEnter(ev) {
|
|
8666
9024
|
const t = ev;
|
|
8667
|
-
|
|
8668
|
-
if (!this.disabled() && t && t.value && dropdown) {
|
|
9025
|
+
if (!this.disabled() && t && t.value) {
|
|
8669
9026
|
const item = {
|
|
8670
9027
|
text: t.value,
|
|
8671
|
-
value: t.value
|
|
9028
|
+
value: t.value,
|
|
8672
9029
|
};
|
|
8673
9030
|
this.setValue(item);
|
|
8674
|
-
this.
|
|
9031
|
+
this.closeDropdown();
|
|
8675
9032
|
}
|
|
8676
9033
|
}
|
|
8677
9034
|
getText(d) {
|
|
@@ -8680,86 +9037,94 @@ class AutocompleteComponent extends AbstractComponent {
|
|
|
8680
9037
|
return typeof d === 'string' ? d : d?.text;
|
|
8681
9038
|
}
|
|
8682
9039
|
handleOutsideEvent(event) {
|
|
9040
|
+
if (!this.isOpen())
|
|
9041
|
+
return;
|
|
8683
9042
|
const target = event.target;
|
|
8684
9043
|
const dropdown = this.dropdown();
|
|
8685
9044
|
const path = event.composedPath ? event.composedPath() : [];
|
|
8686
9045
|
const clickedInsideHost = this.hostRef?.nativeElement?.contains(target);
|
|
8687
|
-
const clickedInsideDropdown = dropdown?.nativeElement?.contains
|
|
8688
|
-
|
|
9046
|
+
const clickedInsideDropdown = dropdown?.nativeElement?.contains
|
|
9047
|
+
? dropdown.nativeElement.contains(target)
|
|
9048
|
+
: false;
|
|
9049
|
+
// Check path for Shadow DOM support
|
|
9050
|
+
const clickedInPath = path.length
|
|
9051
|
+
? path.some(p => p === this.hostRef.nativeElement || (dropdown && p === dropdown.nativeElement))
|
|
9052
|
+
: false;
|
|
8689
9053
|
if (!(clickedInsideHost || clickedInsideDropdown || clickedInPath)) {
|
|
8690
9054
|
this.closeDropdown();
|
|
8691
9055
|
}
|
|
8692
9056
|
}
|
|
8693
9057
|
openDropdown() {
|
|
8694
|
-
|
|
8695
|
-
if (!dropdown || this.isOpen())
|
|
9058
|
+
if (this.isOpen())
|
|
8696
9059
|
return;
|
|
8697
|
-
this.renderer.setStyle(dropdown.nativeElement, 'display', 'block');
|
|
8698
9060
|
this.isOpen.set(true);
|
|
8699
9061
|
}
|
|
8700
9062
|
closeDropdown() {
|
|
8701
|
-
|
|
8702
|
-
if (!dropdown || !this.isOpen())
|
|
9063
|
+
if (!this.isOpen())
|
|
8703
9064
|
return;
|
|
8704
|
-
this.renderer.setStyle(dropdown.nativeElement, 'display', 'none');
|
|
8705
9065
|
this.isOpen.set(false);
|
|
8706
|
-
this.clearDropdown();
|
|
8707
9066
|
this.acLoading.set(false);
|
|
8708
9067
|
}
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
if (!dropdown)
|
|
8712
|
-
return;
|
|
8713
|
-
while (dropdown.nativeElement.firstChild) {
|
|
8714
|
-
dropdown.nativeElement.removeChild(dropdown.nativeElement.lastChild);
|
|
8715
|
-
}
|
|
8716
|
-
}
|
|
8717
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteComponent, deps: [{ token: UniqueIdService }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i2$2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8718
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: AutocompleteComponent, isStandalone: false, selector: "rlb-autocomplete", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "max-height", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, charsToSearch: { classPropertyName: "charsToSearch", publicName: "chars-to-search", isSignal: true, isRequired: false, transformFunction: null }, menuMaxWidth: { classPropertyName: "menuMaxWidth", publicName: "menu-max-width", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, enableValidation: { classPropertyName: "enableValidation", publicName: "enable-validation", isSignal: true, isRequired: false, transformFunction: null }, inputAutocomplete: { classPropertyName: "inputAutocomplete", publicName: "inputAutocomplete", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", selected: "selected" }, host: { listeners: { "document:pointerdown": "onDocumentPointerDown($event)", "document:keydown.escape": "onEscape($event)" }, styleAttribute: "position: relative;" }, viewQueries: [{ propertyName: "el", first: true, predicate: ["field"], descendants: true, isSignal: true }, { propertyName: "dropdown", first: true, predicate: ["autocomplete"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
9068
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteComponent, deps: [{ token: UniqueIdService }, { token: i0.ElementRef }, { token: i2$2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9069
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: AutocompleteComponent, isStandalone: false, selector: "rlb-autocomplete", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "max-height", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, charsToSearch: { classPropertyName: "charsToSearch", publicName: "chars-to-search", isSignal: true, isRequired: false, transformFunction: null }, menuMaxWidth: { classPropertyName: "menuMaxWidth", publicName: "menu-max-width", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, enableValidation: { classPropertyName: "enableValidation", publicName: "enable-validation", isSignal: true, isRequired: false, transformFunction: null }, inputAutocomplete: { classPropertyName: "inputAutocomplete", publicName: "inputAutocomplete", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", selected: "selected" }, host: { listeners: { "document:pointerdown": "onDocumentPointerDown($event)", "document:keydown.escape": "onEscape($event)" } }, viewQueries: [{ propertyName: "el", first: true, predicate: ["field"], descendants: true, isSignal: true }, { propertyName: "dropdown", first: true, predicate: ["autocomplete"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
8719
9070
|
<ng-content select="[before]"></ng-content>
|
|
8720
|
-
<div class="input-group has-validation">
|
|
9071
|
+
<div class="input-group has-validation position-relative">
|
|
8721
9072
|
<input
|
|
8722
9073
|
#field
|
|
8723
|
-
[id]="id"
|
|
8724
9074
|
class="form-control"
|
|
9075
|
+
[value]="getText(value)"
|
|
9076
|
+
(input)="update($event.target)"
|
|
9077
|
+
(keyup.enter)="onEnter($event.target)"
|
|
9078
|
+
(blur)="touch()"
|
|
9079
|
+
[id]="id"
|
|
8725
9080
|
[type]="type()"
|
|
8726
|
-
[attr.autocomplete]="inputAutocomplete()"
|
|
8727
9081
|
[attr.disabled]="disabled() ? true : undefined"
|
|
9082
|
+
[class.is-invalid]="control?.touched && control?.invalid && enableValidation()"
|
|
9083
|
+
[attr.autocomplete]="inputAutocomplete()"
|
|
8728
9084
|
[attr.readonly]="readonly() ? true : undefined"
|
|
8729
9085
|
[attr.placeholder]="placeholder()"
|
|
8730
9086
|
[class.form-control-lg]="size() === 'large'"
|
|
8731
9087
|
[class.form-control-sm]="size() === 'small'"
|
|
8732
|
-
[
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
'is-invalid': control?.touched && control?.invalid && enableValidation(),
|
|
8736
|
-
'is-valid': control?.touched && control?.valid && enableValidation()
|
|
9088
|
+
[ngClass]="{
|
|
9089
|
+
'is-invalid': control?.touched && control?.invalid && enableValidation(),
|
|
9090
|
+
'is-valid': control?.touched && control?.valid && enableValidation(),
|
|
8737
9091
|
}"
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
9092
|
+
/>
|
|
9093
|
+
|
|
9094
|
+
@if (isOpen()) {
|
|
9095
|
+
<div
|
|
9096
|
+
#autocomplete
|
|
9097
|
+
class="dropdown-menu show w-100 position-absolute overflow-y-auto"
|
|
9098
|
+
[style.max-height.px]="maxHeight()"
|
|
9099
|
+
[style.max-width.px]="menuMaxWidth()"
|
|
9100
|
+
style="z-index: 1000; top: 100%;"
|
|
9101
|
+
>
|
|
9102
|
+
@if (acLoading()) {
|
|
9103
|
+
<div class="dropdown-item disabled text-center">Loading...</div>
|
|
9104
|
+
} @else if (!hasSuggestions()) {
|
|
9105
|
+
<a class="dropdown-item disabled text-center">No suggestions</a>
|
|
9106
|
+
} @else {
|
|
9107
|
+
@for (item of suggestions(); track item.value) {
|
|
9108
|
+
<a
|
|
9109
|
+
class="dropdown-item"
|
|
9110
|
+
(click)="selectItem(item, $event)"
|
|
9111
|
+
style="cursor: pointer"
|
|
9112
|
+
>
|
|
9113
|
+
@if (item.iconClass) {
|
|
9114
|
+
<i
|
|
9115
|
+
[class]="item.iconClass"
|
|
9116
|
+
class="me-2"
|
|
9117
|
+
></i>
|
|
9118
|
+
}
|
|
9119
|
+
{{ item.text }}
|
|
9120
|
+
</a>
|
|
9121
|
+
}
|
|
9122
|
+
}
|
|
9123
|
+
</div>
|
|
8752
9124
|
}
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
[id]="id+'-ac'"
|
|
8757
|
-
class="dropdown-menu overflow-y-auto w-100 position-absolute"
|
|
8758
|
-
aria-labelledby="dropdownMenu"
|
|
8759
|
-
[style.max-height.px]="maxHeight()"
|
|
8760
|
-
[style.width]="'fit-content !important'"
|
|
8761
|
-
[style.max-width.px]="menuMaxWidth()"></div>
|
|
8762
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: InputValidationComponent, selector: "rlb-input-validation", inputs: ["errors"], outputs: ["errorsChange"] }, { kind: "component", type: ProgressComponent, selector: "rlb-progress", inputs: ["max", "min", "value", "height", "animated", "striped", "infinite", "aria-label", "showValue", "color", "text-color"] }] }); }
|
|
9125
|
+
</div>
|
|
9126
|
+
<ng-content select="[after]"></ng-content>
|
|
9127
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
8763
9128
|
}
|
|
8764
9129
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
8765
9130
|
type: Component,
|
|
@@ -8767,55 +9132,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8767
9132
|
selector: 'rlb-autocomplete',
|
|
8768
9133
|
template: `
|
|
8769
9134
|
<ng-content select="[before]"></ng-content>
|
|
8770
|
-
<div class="input-group has-validation">
|
|
9135
|
+
<div class="input-group has-validation position-relative">
|
|
8771
9136
|
<input
|
|
8772
9137
|
#field
|
|
8773
|
-
[id]="id"
|
|
8774
9138
|
class="form-control"
|
|
9139
|
+
[value]="getText(value)"
|
|
9140
|
+
(input)="update($event.target)"
|
|
9141
|
+
(keyup.enter)="onEnter($event.target)"
|
|
9142
|
+
(blur)="touch()"
|
|
9143
|
+
[id]="id"
|
|
8775
9144
|
[type]="type()"
|
|
8776
|
-
[attr.autocomplete]="inputAutocomplete()"
|
|
8777
9145
|
[attr.disabled]="disabled() ? true : undefined"
|
|
9146
|
+
[class.is-invalid]="control?.touched && control?.invalid && enableValidation()"
|
|
9147
|
+
[attr.autocomplete]="inputAutocomplete()"
|
|
8778
9148
|
[attr.readonly]="readonly() ? true : undefined"
|
|
8779
9149
|
[attr.placeholder]="placeholder()"
|
|
8780
9150
|
[class.form-control-lg]="size() === 'large'"
|
|
8781
9151
|
[class.form-control-sm]="size() === 'small'"
|
|
8782
|
-
[
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
'is-invalid': control?.touched && control?.invalid && enableValidation(),
|
|
8786
|
-
'is-valid': control?.touched && control?.valid && enableValidation()
|
|
9152
|
+
[ngClass]="{
|
|
9153
|
+
'is-invalid': control?.touched && control?.invalid && enableValidation(),
|
|
9154
|
+
'is-valid': control?.touched && control?.valid && enableValidation(),
|
|
8787
9155
|
}"
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
9156
|
+
/>
|
|
9157
|
+
|
|
9158
|
+
@if (isOpen()) {
|
|
9159
|
+
<div
|
|
9160
|
+
#autocomplete
|
|
9161
|
+
class="dropdown-menu show w-100 position-absolute overflow-y-auto"
|
|
9162
|
+
[style.max-height.px]="maxHeight()"
|
|
9163
|
+
[style.max-width.px]="menuMaxWidth()"
|
|
9164
|
+
style="z-index: 1000; top: 100%;"
|
|
9165
|
+
>
|
|
9166
|
+
@if (acLoading()) {
|
|
9167
|
+
<div class="dropdown-item disabled text-center">Loading...</div>
|
|
9168
|
+
} @else if (!hasSuggestions()) {
|
|
9169
|
+
<a class="dropdown-item disabled text-center">No suggestions</a>
|
|
9170
|
+
} @else {
|
|
9171
|
+
@for (item of suggestions(); track item.value) {
|
|
9172
|
+
<a
|
|
9173
|
+
class="dropdown-item"
|
|
9174
|
+
(click)="selectItem(item, $event)"
|
|
9175
|
+
style="cursor: pointer"
|
|
9176
|
+
>
|
|
9177
|
+
@if (item.iconClass) {
|
|
9178
|
+
<i
|
|
9179
|
+
[class]="item.iconClass"
|
|
9180
|
+
class="me-2"
|
|
9181
|
+
></i>
|
|
9182
|
+
}
|
|
9183
|
+
{{ item.text }}
|
|
9184
|
+
</a>
|
|
9185
|
+
}
|
|
9186
|
+
}
|
|
9187
|
+
</div>
|
|
8802
9188
|
}
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
[id]="id+'-ac'"
|
|
8807
|
-
class="dropdown-menu overflow-y-auto w-100 position-absolute"
|
|
8808
|
-
aria-labelledby="dropdownMenu"
|
|
8809
|
-
[style.max-height.px]="maxHeight()"
|
|
8810
|
-
[style.width]="'fit-content !important'"
|
|
8811
|
-
[style.max-width.px]="menuMaxWidth()"></div>
|
|
8812
|
-
`,
|
|
9189
|
+
</div>
|
|
9190
|
+
<ng-content select="[after]"></ng-content>
|
|
9191
|
+
`,
|
|
8813
9192
|
standalone: false,
|
|
8814
|
-
host: {
|
|
8815
|
-
style: 'position: relative;',
|
|
8816
|
-
}
|
|
8817
9193
|
}]
|
|
8818
|
-
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.
|
|
9194
|
+
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.ElementRef }, { type: i2$2.NgControl, decorators: [{
|
|
8819
9195
|
type: Self
|
|
8820
9196
|
}, {
|
|
8821
9197
|
type: Optional
|
|
@@ -8831,7 +9207,7 @@ class CheckboxComponent extends AbstractComponent {
|
|
|
8831
9207
|
constructor(idService, control) {
|
|
8832
9208
|
super(idService, control);
|
|
8833
9209
|
this.control = control;
|
|
8834
|
-
this.disabled = input(false, { transform: booleanAttribute });
|
|
9210
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
8835
9211
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
8836
9212
|
this.indeterminate = input(false, { ...(ngDevMode ? { debugName: "indeterminate" } : {}), transform: booleanAttribute });
|
|
8837
9213
|
this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : {}), alias: 'id' });
|
|
@@ -8899,7 +9275,8 @@ class CheckboxComponent extends AbstractComponent {
|
|
|
8899
9275
|
</div>
|
|
8900
9276
|
}
|
|
8901
9277
|
<ng-content select="[after]"></ng-content>
|
|
8902
|
-
</div
|
|
9278
|
+
</div>
|
|
9279
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i3.JsonPipe, name: "json" }] }); }
|
|
8903
9280
|
}
|
|
8904
9281
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
8905
9282
|
type: Component,
|
|
@@ -8926,8 +9303,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8926
9303
|
</div>
|
|
8927
9304
|
}
|
|
8928
9305
|
<ng-content select="[after]"></ng-content>
|
|
8929
|
-
</div
|
|
8930
|
-
|
|
9306
|
+
</div>
|
|
9307
|
+
`,
|
|
9308
|
+
standalone: false,
|
|
8931
9309
|
}]
|
|
8932
9310
|
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i2$2.NgControl, decorators: [{
|
|
8933
9311
|
type: Self
|
|
@@ -9023,7 +9401,7 @@ class DatalistComponent extends AbstractComponent {
|
|
|
9023
9401
|
constructor(idService, control) {
|
|
9024
9402
|
super(idService, control);
|
|
9025
9403
|
this.control = control;
|
|
9026
|
-
this.disabled = input(false, { transform: booleanAttribute });
|
|
9404
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
9027
9405
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
9028
9406
|
this.placeholder = input(undefined, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
9029
9407
|
this.size = input(undefined, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
@@ -9065,10 +9443,11 @@ class DatalistComponent extends AbstractComponent {
|
|
|
9065
9443
|
<ng-content></ng-content>
|
|
9066
9444
|
</datalist>
|
|
9067
9445
|
@if (errors() && showError()) {
|
|
9068
|
-
<rlb-input-validation [errors]="errors()"/>
|
|
9446
|
+
<rlb-input-validation [errors]="errors()" />
|
|
9069
9447
|
}
|
|
9070
9448
|
</div>
|
|
9071
|
-
<ng-content select="[after]"></ng-content
|
|
9449
|
+
<ng-content select="[after]"></ng-content>
|
|
9450
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: InputValidationComponent, selector: "rlb-input-validation", inputs: ["errors"], outputs: ["errorsChange"] }] }); }
|
|
9072
9451
|
}
|
|
9073
9452
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: DatalistComponent, decorators: [{
|
|
9074
9453
|
type: Component,
|
|
@@ -9096,11 +9475,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
9096
9475
|
<ng-content></ng-content>
|
|
9097
9476
|
</datalist>
|
|
9098
9477
|
@if (errors() && showError()) {
|
|
9099
|
-
<rlb-input-validation [errors]="errors()"/>
|
|
9478
|
+
<rlb-input-validation [errors]="errors()" />
|
|
9100
9479
|
}
|
|
9101
9480
|
</div>
|
|
9102
|
-
<ng-content select="[after]"></ng-content
|
|
9103
|
-
|
|
9481
|
+
<ng-content select="[after]"></ng-content>
|
|
9482
|
+
`,
|
|
9483
|
+
standalone: false,
|
|
9104
9484
|
}]
|
|
9105
9485
|
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i2$2.NgControl, decorators: [{
|
|
9106
9486
|
type: Self
|
|
@@ -9274,7 +9654,7 @@ class FileComponent extends AbstractComponent {
|
|
|
9274
9654
|
constructor(idService, control) {
|
|
9275
9655
|
super(idService, control);
|
|
9276
9656
|
this.control = control;
|
|
9277
|
-
this.disabled = input(false, { transform: booleanAttribute });
|
|
9657
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
9278
9658
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
9279
9659
|
this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : {}), transform: booleanAttribute });
|
|
9280
9660
|
this.size = input(undefined, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
@@ -9321,7 +9701,8 @@ class FileComponent extends AbstractComponent {
|
|
|
9321
9701
|
{{ errors | json }}
|
|
9322
9702
|
</div>
|
|
9323
9703
|
</div>
|
|
9324
|
-
<ng-content select="[after]"></ng-content
|
|
9704
|
+
<ng-content select="[after]"></ng-content>
|
|
9705
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i3.JsonPipe, name: "json" }] }); }
|
|
9325
9706
|
}
|
|
9326
9707
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: FileComponent, decorators: [{
|
|
9327
9708
|
type: Component,
|
|
@@ -9352,8 +9733,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
9352
9733
|
{{ errors | json }}
|
|
9353
9734
|
</div>
|
|
9354
9735
|
</div>
|
|
9355
|
-
<ng-content select="[after]"></ng-content
|
|
9356
|
-
|
|
9736
|
+
<ng-content select="[after]"></ng-content>
|
|
9737
|
+
`,
|
|
9738
|
+
standalone: false,
|
|
9357
9739
|
}]
|
|
9358
9740
|
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i2$2.NgControl, decorators: [{
|
|
9359
9741
|
type: Self
|
|
@@ -9699,7 +10081,7 @@ class RadioComponent extends AbstractComponent {
|
|
|
9699
10081
|
constructor(idService, control) {
|
|
9700
10082
|
super(idService, control);
|
|
9701
10083
|
this.control = control;
|
|
9702
|
-
this.disabled = input(false, { transform: booleanAttribute });
|
|
10084
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
9703
10085
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
9704
10086
|
this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : {}), alias: 'id', transform: (v) => v || '' });
|
|
9705
10087
|
this.options = contentChildren(OptionComponent, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
@@ -9821,7 +10203,7 @@ class RangeComponent extends AbstractComponent {
|
|
|
9821
10203
|
constructor(idService, control) {
|
|
9822
10204
|
super(idService, control);
|
|
9823
10205
|
this.control = control;
|
|
9824
|
-
this.disabled = input(false, { transform: booleanAttribute });
|
|
10206
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
9825
10207
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
9826
10208
|
this.min = input(undefined, { ...(ngDevMode ? { debugName: "min" } : {}), transform: numberAttribute });
|
|
9827
10209
|
this.max = input(undefined, { ...(ngDevMode ? { debugName: "max" } : {}), transform: numberAttribute });
|
|
@@ -9864,7 +10246,8 @@ class RangeComponent extends AbstractComponent {
|
|
|
9864
10246
|
{{ errors() | json }}
|
|
9865
10247
|
</div>
|
|
9866
10248
|
</div>
|
|
9867
|
-
<ng-content select="[after]"></ng-content
|
|
10249
|
+
<ng-content select="[after]"></ng-content>
|
|
10250
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i3.JsonPipe, name: "json" }] }); }
|
|
9868
10251
|
}
|
|
9869
10252
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: RangeComponent, decorators: [{
|
|
9870
10253
|
type: Component,
|
|
@@ -9894,8 +10277,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
9894
10277
|
{{ errors() | json }}
|
|
9895
10278
|
</div>
|
|
9896
10279
|
</div>
|
|
9897
|
-
<ng-content select="[after]"></ng-content
|
|
9898
|
-
|
|
10280
|
+
<ng-content select="[after]"></ng-content>
|
|
10281
|
+
`,
|
|
10282
|
+
standalone: false,
|
|
9899
10283
|
}]
|
|
9900
10284
|
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i2$2.NgControl, decorators: [{
|
|
9901
10285
|
type: Self
|
|
@@ -10010,7 +10394,7 @@ class TextAreaComponent extends AbstractComponent {
|
|
|
10010
10394
|
constructor(idService, control) {
|
|
10011
10395
|
super(idService, control);
|
|
10012
10396
|
this.control = control;
|
|
10013
|
-
this.disabled = input(false, { transform: booleanAttribute });
|
|
10397
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
10014
10398
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
|
|
10015
10399
|
this.placeholder = input(undefined, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
10016
10400
|
this.size = input(undefined, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
@@ -10051,10 +10435,11 @@ class TextAreaComponent extends AbstractComponent {
|
|
|
10051
10435
|
(input)="update($event.target)"
|
|
10052
10436
|
></textarea>
|
|
10053
10437
|
@if (errors() && showError()) {
|
|
10054
|
-
<rlb-input-validation [errors]="errors()"/>
|
|
10438
|
+
<rlb-input-validation [errors]="errors()" />
|
|
10055
10439
|
}
|
|
10056
10440
|
</div>
|
|
10057
|
-
<ng-content select="[after]"></ng-content
|
|
10441
|
+
<ng-content select="[after]"></ng-content>
|
|
10442
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: InputValidationComponent, selector: "rlb-input-validation", inputs: ["errors"], outputs: ["errorsChange"] }] }); }
|
|
10058
10443
|
}
|
|
10059
10444
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TextAreaComponent, decorators: [{
|
|
10060
10445
|
type: Component,
|
|
@@ -10079,11 +10464,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
10079
10464
|
(input)="update($event.target)"
|
|
10080
10465
|
></textarea>
|
|
10081
10466
|
@if (errors() && showError()) {
|
|
10082
|
-
<rlb-input-validation [errors]="errors()"/>
|
|
10467
|
+
<rlb-input-validation [errors]="errors()" />
|
|
10083
10468
|
}
|
|
10084
10469
|
</div>
|
|
10085
|
-
<ng-content select="[after]"></ng-content
|
|
10086
|
-
|
|
10470
|
+
<ng-content select="[after]"></ng-content>
|
|
10471
|
+
`,
|
|
10472
|
+
standalone: false,
|
|
10087
10473
|
}]
|
|
10088
10474
|
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i2$2.NgControl, decorators: [{
|
|
10089
10475
|
type: Self
|