@wlcm/angular 18.2.22 → 18.2.25
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/datepicker/fesm2022/wlcm-angular-datepicker.mjs +2 -2
- package/datepicker/fesm2022/wlcm-angular-datepicker.mjs.map +1 -1
- package/forms/fesm2022/wlcm-angular-forms.mjs +20 -16
- package/forms/fesm2022/wlcm-angular-forms.mjs.map +1 -1
- package/forms/lib/forms/components/autocomplete/autocomplete.component.d.ts +3 -2
- package/forms/lib/forms/components/select/select.component.d.ts +1 -0
- package/package.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Component, ChangeDetectionStrategy, Injectable, InjectionToken, inject, Directive, Pipe, Inject, HostListener, forwardRef, ChangeDetectorRef, Optional, Input, ContentChild, ViewChild, HostBinding, EventEmitter, NgZone, Host, Output, input, output, ElementRef, contentChildren, computed, signal, effect, viewChildren, NgModule } from '@angular/core';
|
2
|
+
import { Component, ChangeDetectionStrategy, Injectable, InjectionToken, inject, Directive, Pipe, Inject, HostListener, forwardRef, ChangeDetectorRef, Optional, Input, ContentChild, ViewChild, HostBinding, EventEmitter, NgZone, Host, Output, input, output, runInInjectionContext, ElementRef, Injector, contentChildren, computed, signal, effect, viewChildren, NgModule } from '@angular/core';
|
3
3
|
import { __decorate, __metadata } from 'tslib';
|
4
4
|
import * as i4 from '@angular/forms';
|
5
5
|
import { Validators, NgControl, ControlContainer, FormControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, ReactiveFormsModule } from '@angular/forms';
|
@@ -19,7 +19,6 @@ import * as i3 from '@angular/material/core';
|
|
19
19
|
import * as i1$2 from '@angular/material/checkbox';
|
20
20
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
21
21
|
import { toObservable } from '@angular/core/rxjs-interop';
|
22
|
-
import { CdkOverlayOrigin } from '@angular/cdk/overlay';
|
23
22
|
import { MatRadioModule, MAT_RADIO_DEFAULT_OPTIONS } from '@angular/material/radio';
|
24
23
|
|
25
24
|
class WlcmErrorComponent {
|
@@ -476,8 +475,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
476
475
|
|
477
476
|
const PANEL_CLASS$1 = 'wlcm-autocomplete-panel';
|
478
477
|
let WlcmAutocompleteComponent = class WlcmAutocompleteComponent extends WlcmAutocomplete {
|
479
|
-
constructor(formField) {
|
478
|
+
constructor(injector, formField) {
|
480
479
|
super();
|
480
|
+
this.injector = injector;
|
481
481
|
this.formField = formField;
|
482
482
|
this.required = false;
|
483
483
|
this.placeholder = '';
|
@@ -506,16 +506,14 @@ let WlcmAutocompleteComponent = class WlcmAutocompleteComponent extends WlcmAuto
|
|
506
506
|
this.handleLoadMoreEvent();
|
507
507
|
this.handleControlValueChanges();
|
508
508
|
this.handleAdjustedValue();
|
509
|
-
if (formField) {
|
510
|
-
this._preferredOverlayOrigin = new MatAutocompleteOrigin(this.formField.inputContainer);
|
511
|
-
}
|
512
509
|
}
|
513
510
|
ngOnInit() {
|
514
511
|
this.loadOptions().pipe(first()).subscribe();
|
515
512
|
}
|
516
513
|
ngAfterViewInit() {
|
517
514
|
this.viewReady$.next();
|
518
|
-
this.
|
515
|
+
const origin = runInInjectionContext(this.injector, () => new MatAutocompleteOrigin(this.formField.inputContainer));
|
516
|
+
this.autocompleteTrigger.connectedTo = origin;
|
519
517
|
this.attachFocusBlurListeners();
|
520
518
|
}
|
521
519
|
displayWith(value) {
|
@@ -627,7 +625,7 @@ let WlcmAutocompleteComponent = class WlcmAutocompleteComponent extends WlcmAuto
|
|
627
625
|
.pipe(switchMap(() => this.adjustedValue$.pipe(filter(Boolean))))
|
628
626
|
.subscribe((value) => this._changed?.(value));
|
629
627
|
}
|
630
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WlcmAutocompleteComponent, deps: [{ token: WLCM_FORM_FIELD }], target: i0.ɵɵFactoryTarget.Component }); }
|
628
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WlcmAutocompleteComponent, deps: [{ token: i0.Injector }, { token: WLCM_FORM_FIELD }], target: i0.ɵɵFactoryTarget.Component }); }
|
631
629
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.4", type: WlcmAutocompleteComponent, isStandalone: true, selector: "wlcm-autocomplete", inputs: { fetchPaginatedOptions: { classPropertyName: "fetchPaginatedOptions", publicName: "fetchPaginatedOptions", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: false, isRequired: false, transformFunction: null }, queryParams: { classPropertyName: "queryParams", publicName: "queryParams", isSignal: false, isRequired: false, transformFunction: (params) => cloneDeep(params) }, selectOptionFormat: { classPropertyName: "selectOptionFormat", publicName: "selectOptionFormat", isSignal: true, isRequired: false, transformFunction: null }, noResultsTemplate: { classPropertyName: "noResultsTemplate", publicName: "noResultsTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, host: { classAttribute: "wlcm-autocomplete" }, providers: [
|
632
630
|
{ provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, useValue: { overlayPanelClass: PANEL_CLASS$1 } },
|
633
631
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => WlcmAutocompleteComponent), multi: true },
|
@@ -643,7 +641,7 @@ let WlcmAutocompleteComponent = class WlcmAutocompleteComponent extends WlcmAuto
|
|
643
641
|
};
|
644
642
|
WlcmAutocompleteComponent = __decorate([
|
645
643
|
UntilDestroy(),
|
646
|
-
__metadata("design:paramtypes", [Object])
|
644
|
+
__metadata("design:paramtypes", [Injector, Object])
|
647
645
|
], WlcmAutocompleteComponent);
|
648
646
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WlcmAutocompleteComponent, decorators: [{
|
649
647
|
type: Component,
|
@@ -668,7 +666,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
668
666
|
},
|
669
667
|
},
|
670
668
|
], template: "<input\n wlcmInput\n type=\"text\"\n [matAutocomplete]=\"autocomplete\"\n [placeholder]=\"placeholder\"\n [formControl]=\"control\"\n (blur)=\"blured()\"\n/>\n\n<mat-autocomplete\n #autocomplete=\"matAutocomplete\"\n wlcmAutocomplete\n [disableRipple]=\"true\"\n [displayWith]=\"displayWith\"\n [hideSingleSelectionIndicator]=\"true\"\n (panelScrolled)=\"loadMore()\"\n>\n <ng-container *rxLet=\"$any(options$ | async); let options\">\n <mat-option\n *ngFor=\"let option of options\"\n [ngClass]=\"{ 'wlcm-custom-option-content': optionTemplate }\"\n [value]=\"option\"\n >\n @if (optionTemplate) {\n <ng-container\n *ngTemplateOutlet=\"optionTemplate; context: { $implicit: option }\"\n ></ng-container>\n } @else {\n {{ option.viewValue }}\n }\n </mat-option>\n\n <mat-option [disabled]=\"true\" *ngIf=\"options.length === 0\">\n @if (noResultsTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"\n noResultsTemplate()!;\n context: { $implicit: control.value, loading: loading$ | async }\n \"\n ></ng-container>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n defaultNoResultsTemplate;\n context: { $implicit: control.value, loading: loading$ | async }\n \"\n ></ng-container>\n }\n </mat-option>\n </ng-container>\n</mat-autocomplete>\n\n<ng-template #defaultNoResultsTemplate let-loading=\"loading\">\n @if (loading) {\n Please wait...\n } @else {\n No results found\n }\n</ng-template>\n" }]
|
671
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
669
|
+
}], ctorParameters: () => [{ type: i0.Injector }, { type: undefined, decorators: [{
|
672
670
|
type: Inject,
|
673
671
|
args: [WLCM_FORM_FIELD]
|
674
672
|
}] }], propDecorators: { fetchPaginatedOptions: [{
|
@@ -945,16 +943,19 @@ let WlcmSelectComponent = class WlcmSelectComponent {
|
|
945
943
|
this.viewReady$ = new Subject();
|
946
944
|
this.selected$ = new Subject();
|
947
945
|
this.compareWith = (optionA, optionB) => {
|
948
|
-
|
946
|
+
if (this.areOptionsEqual(optionA, optionB)) {
|
947
|
+
if (this.selectOptionFormat() === 'CompleteOption' && typeof optionB !== 'object') {
|
948
|
+
this._changed?.(optionA);
|
949
|
+
}
|
950
|
+
return true;
|
951
|
+
}
|
952
|
+
return false;
|
949
953
|
};
|
950
954
|
this.focus = () => this.matSelect.open();
|
951
955
|
this.isFocused = () => this.isOpen;
|
952
956
|
if (this.parentFormMember) {
|
953
957
|
this.handleStateChange();
|
954
958
|
}
|
955
|
-
if (formField) {
|
956
|
-
this._preferredOverlayOrigin = new CdkOverlayOrigin(this.formField.inputContainer);
|
957
|
-
}
|
958
959
|
this.handleAdjustedValue();
|
959
960
|
toObservable(this.paginated)
|
960
961
|
.pipe(untilDestroyed(this))
|
@@ -965,8 +966,8 @@ let WlcmSelectComponent = class WlcmSelectComponent {
|
|
965
966
|
}
|
966
967
|
ngAfterViewInit() {
|
967
968
|
this.viewReady$.next();
|
968
|
-
if (this.
|
969
|
-
this.matSelect._preferredOverlayOrigin = this.
|
969
|
+
if (this.formField) {
|
970
|
+
this.matSelect._preferredOverlayOrigin = this.formField.inputContainer;
|
970
971
|
}
|
971
972
|
this._focusStream$.next(this.matSelect._openedStream);
|
972
973
|
this._blurStream$.next(this.matSelect._closedStream);
|
@@ -985,6 +986,9 @@ let WlcmSelectComponent = class WlcmSelectComponent {
|
|
985
986
|
this.selectionChange.emit(event);
|
986
987
|
});
|
987
988
|
}
|
989
|
+
areOptionsEqual(optionA, optionB) {
|
990
|
+
return (optionA?.value || optionA) === (optionB?.value || optionB);
|
991
|
+
}
|
988
992
|
revertPreviousValue() {
|
989
993
|
this.matSelect.value = this._previousValue;
|
990
994
|
}
|