@wlcm/angular 17.5.31 → 17.5.33

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.
Files changed (23) hide show
  1. package/forms/esm2022/lib/forms/components/autocomplete/autocomplete.component.mjs +7 -5
  2. package/forms/esm2022/lib/forms/components/form-field/form-field.component.mjs +4 -3
  3. package/forms/esm2022/lib/forms/components/index.mjs +2 -1
  4. package/forms/esm2022/lib/forms/components/partials/autocomplete-suffix/autocomplete-suffix.component.mjs +19 -0
  5. package/forms/esm2022/lib/forms/components/partials/index.mjs +2 -0
  6. package/forms/esm2022/lib/forms/components/select/select.component.mjs +9 -1
  7. package/forms/esm2022/lib/forms/forms.module.mjs +5 -1
  8. package/forms/esm2022/lib/forms/models/autocomplete.models.mjs +10 -2
  9. package/forms/esm2022/lib/forms/services/places.api.mjs +5 -1
  10. package/forms/fesm2022/wlcm-angular-forms.mjs +46 -8
  11. package/forms/fesm2022/wlcm-angular-forms.mjs.map +1 -1
  12. package/forms/lib/forms/components/autocomplete/autocomplete.component.d.ts +3 -3
  13. package/forms/lib/forms/components/index.d.ts +1 -0
  14. package/forms/lib/forms/components/partials/autocomplete-suffix/autocomplete-suffix.component.d.ts +10 -0
  15. package/forms/lib/forms/components/partials/index.d.ts +1 -0
  16. package/forms/lib/forms/components/select/select.component.d.ts +1 -0
  17. package/forms/lib/forms/forms.module.d.ts +11 -10
  18. package/forms/lib/forms/models/autocomplete.models.d.ts +7 -0
  19. package/package.json +1 -1
  20. package/styles/components/datepicker/date-range-picker/_date-range-picker-input.scss +6 -0
  21. package/styles/components/forms/_autocomplete.scss +18 -0
  22. package/styles/components/forms/_form-field.scss +1 -0
  23. package/styles/components/forms/_select.scss +6 -0
@@ -6,7 +6,7 @@ import { Validators, NgControl, ControlContainer, FormControl, NG_VALUE_ACCESSOR
6
6
  import * as i1 from '@angular/common';
7
7
  import { CommonModule } from '@angular/common';
8
8
  import { Subject, Observable, takeUntil, merge, fromEvent, observeOn, asyncScheduler, BehaviorSubject, EMPTY, switchMap, take, tap, concatMap, filter, timer, map, first } from 'rxjs';
9
- import { WlcmAutocompleteOption, DEFAULT_QUERY_PARAMS, WlcmIconName, WlcmIconDirective } from '@wlcm/angular/core';
9
+ import { WlcmAutocompleteOption, DEFAULT_QUERY_PARAMS, WlcmIconName, WlcmIconDirective, WlcmLoaderComponent } from '@wlcm/angular/core';
10
10
  import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
11
11
  import * as i3$1 from '@angular/material/select';
12
12
  import { MatOption, MAT_SELECT_CONFIG, MatSelect, MatSelectModule } from '@angular/material/select';
@@ -75,6 +75,10 @@ class WlcmDefaultPlacesApi {
75
75
  }
76
76
  getPlacesPaginated(query) {
77
77
  return new Observable((subscriber) => {
78
+ if (query.length === 0) {
79
+ subscriber.next({ ...DEFAULT_PAGINATED_DATA });
80
+ return subscriber.complete();
81
+ }
78
82
  const request = { input: query };
79
83
  this._autocompleteService.getPlacePredictions(request, (predictions, status) => {
80
84
  const result = { ...DEFAULT_PAGINATED_DATA };
@@ -247,8 +251,9 @@ let WlcmFormFieldComponent = class WlcmFormFieldComponent {
247
251
  this.handleStateChanges();
248
252
  }
249
253
  focus() {
250
- if (!this.isFocused)
251
- this.inputRef?.focus();
254
+ if (this.isFocused || this.isDisabled)
255
+ return;
256
+ this.inputRef?.focus();
252
257
  }
253
258
  get control() {
254
259
  return (this.controlContainer?.control || this.ngControl?.control) ?? null;
@@ -458,9 +463,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
458
463
  type: Output
459
464
  }] } });
460
465
 
466
+ class WlcmAutocomplete {
467
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: WlcmAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
468
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.5", type: WlcmAutocomplete, ngImport: i0 }); }
469
+ }
470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: WlcmAutocomplete, decorators: [{
471
+ type: Directive
472
+ }] });
473
+
461
474
  const PANEL_CLASS$1 = 'wlcm-autocomplete-panel';
462
- let WlcmAutocompleteComponent = class WlcmAutocompleteComponent {
475
+ let WlcmAutocompleteComponent = class WlcmAutocompleteComponent extends WlcmAutocomplete {
463
476
  constructor(formField) {
477
+ super();
464
478
  this.formField = formField;
465
479
  this.required = false;
466
480
  this.placeholder = '';
@@ -547,11 +561,11 @@ let WlcmAutocompleteComponent = class WlcmAutocompleteComponent {
547
561
  }));
548
562
  }
549
563
  handleLoadMoreEvent() {
550
- this._loading$.next(true);
551
564
  this._loadMore$
552
565
  .pipe(concatMap(() => {
553
566
  if (this._paginatedData && this._paginatedData.currPage + 1 <= this._paginatedData.totalPages) {
554
567
  this.queryParams.page++;
568
+ this._loading$.next(true);
555
569
  return this.pullDataMethod(this.queryParams).pipe(tap((paginatedData) => {
556
570
  this._paginatedData = paginatedData;
557
571
  this._options$.next([...this._options$.value, ...paginatedData.data]);
@@ -597,7 +611,7 @@ let WlcmAutocompleteComponent = class WlcmAutocompleteComponent {
597
611
  return { bind: () => autocomplete };
598
612
  },
599
613
  },
600
- ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: WLCM_INPUT, descendants: true, read: ElementRef }, { propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true }, { propertyName: "autocomplete", first: true, predicate: MatAutocomplete, descendants: true }], ngImport: i0, 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 *ngFor=\"let option of options\" [value]=\"option\">\n {{ option.viewValue }}\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 }\n \"\n ></ng-container>\n } @else {\n No results found\n }\n </mat-option>\n </ng-container>\n</mat-autocomplete>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i1$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i1$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "directive", type: AutocompleteDirective, selector: "[wlcmAutocomplete]", outputs: ["panelScrolled"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: WlcmInputDirective, selector: "[wlcmInput]" }, { kind: "directive", type: RxLet, selector: "[rxLet]", inputs: ["rxLet", "rxLetStrategy", "rxLetComplete", "rxLetError", "rxLetSuspense", "rxLetContextTrigger", "rxLetCompleteTrigger", "rxLetErrorTrigger", "rxLetSuspenseTrigger", "rxLetNextTrigger", "rxLetRenderCallback", "rxLetParent", "rxLetPatchZone"], outputs: ["rendered"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
614
+ ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: WLCM_INPUT, descendants: true, read: ElementRef }, { propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true }, { propertyName: "autocomplete", first: true, predicate: MatAutocomplete, descendants: true }], exportAs: ["wlcmAutocomplete"], usesInheritance: true, ngImport: i0, 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 *ngFor=\"let option of options\" [value]=\"option\">\n {{ option.viewValue }}\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 }\n \"\n ></ng-container>\n } @else {\n No results found\n }\n </mat-option>\n </ng-container>\n</mat-autocomplete>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i1$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i1$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "directive", type: AutocompleteDirective, selector: "[wlcmAutocomplete]", outputs: ["panelScrolled"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: WlcmInputDirective, selector: "[wlcmInput]" }, { kind: "directive", type: RxLet, selector: "[rxLet]", inputs: ["rxLet", "rxLetStrategy", "rxLetComplete", "rxLetError", "rxLetSuspense", "rxLetContextTrigger", "rxLetCompleteTrigger", "rxLetErrorTrigger", "rxLetSuspenseTrigger", "rxLetNextTrigger", "rxLetRenderCallback", "rxLetParent", "rxLetPatchZone"], outputs: ["rendered"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
601
615
  };
602
616
  WlcmAutocompleteComponent = __decorate([
603
617
  UntilDestroy(),
@@ -605,7 +619,7 @@ WlcmAutocompleteComponent = __decorate([
605
619
  ], WlcmAutocompleteComponent);
606
620
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: WlcmAutocompleteComponent, decorators: [{
607
621
  type: Component,
608
- args: [{ selector: 'wlcm-autocomplete', host: { class: 'wlcm-autocomplete' }, standalone: true, imports: [
622
+ args: [{ selector: 'wlcm-autocomplete', exportAs: 'wlcmAutocomplete', host: { class: 'wlcm-autocomplete' }, standalone: true, imports: [
609
623
  CommonModule,
610
624
  MatAutocompleteModule,
611
625
  AutocompleteDirective,
@@ -713,6 +727,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
713
727
  args: [WLCM_FORM_CONTROL]
714
728
  }] }] });
715
729
 
730
+ class WlcmAutocompleteSuffixComponent {
731
+ constructor() {
732
+ this.autocomplete = input.required();
733
+ this.WlcmIconName = WlcmIconName;
734
+ }
735
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: WlcmAutocompleteSuffixComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
736
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: WlcmAutocompleteSuffixComponent, isStandalone: true, selector: "wlcm-autocomplete-suffix", inputs: { autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "wlcm-autocomplete-suffix" }, ngImport: i0, template: "<ng-container *rxLet=\"autocomplete().loading$ | async; let loading\">\n @if (!loading) {\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n }\n\n <wlcm-loader [hidden]=\"!loading\"></wlcm-loader>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "directive", type: WlcmIconDirective, selector: "[wlcmIcon]", inputs: ["wlcmIcon", "wlcmIconStopPropagation"], outputs: ["wlcmIconClicked"] }, { kind: "component", type: WlcmLoaderComponent, selector: "wlcm-loader", inputs: ["hidden"] }, { kind: "directive", type: RxLet, selector: "[rxLet]", inputs: ["rxLet", "rxLetStrategy", "rxLetComplete", "rxLetError", "rxLetSuspense", "rxLetContextTrigger", "rxLetCompleteTrigger", "rxLetErrorTrigger", "rxLetSuspenseTrigger", "rxLetNextTrigger", "rxLetRenderCallback", "rxLetParent", "rxLetPatchZone"], outputs: ["rendered"] }] }); }
737
+ }
738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: WlcmAutocompleteSuffixComponent, decorators: [{
739
+ type: Component,
740
+ args: [{ selector: 'wlcm-autocomplete-suffix', host: { class: 'wlcm-autocomplete-suffix' }, standalone: true, imports: [CommonModule, WlcmIconDirective, WlcmLoaderComponent, RxLet], template: "<ng-container *rxLet=\"autocomplete().loading$ | async; let loading\">\n @if (!loading) {\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n }\n\n <wlcm-loader [hidden]=\"!loading\"></wlcm-loader>\n</ng-container>\n" }]
741
+ }] });
742
+
716
743
  class WlcmSelectInputBinderDirective {
717
744
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: WlcmSelectInputBinderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
718
745
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.5", type: WlcmSelectInputBinderDirective, isStandalone: true, selector: "[wlcmSelectInputBinder]", providers: [
@@ -821,6 +848,14 @@ let WlcmSelectComponent = class WlcmSelectComponent {
821
848
  registerOnValidatorChange(callback) {
822
849
  this._validatorChanged = callback;
823
850
  }
851
+ setDisabledState(isDisabled) {
852
+ if (isDisabled) {
853
+ this.control.disable();
854
+ }
855
+ else {
856
+ this.control.enable();
857
+ }
858
+ }
824
859
  validate() {
825
860
  return null;
826
861
  }
@@ -921,6 +956,7 @@ const directives = [
921
956
  const components = [
922
957
  WlcmFormFieldComponent,
923
958
  WlcmAutocompleteComponent,
959
+ WlcmAutocompleteSuffixComponent,
924
960
  WlcmCheckboxComponent,
925
961
  WlcmSelectComponent,
926
962
  WlcmLabelComponent,
@@ -929,6 +965,7 @@ class WlcmFormsModule {
929
965
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: WlcmFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
930
966
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.5", ngImport: i0, type: WlcmFormsModule, imports: [WlcmFormFieldComponent,
931
967
  WlcmAutocompleteComponent,
968
+ WlcmAutocompleteSuffixComponent,
932
969
  WlcmCheckboxComponent,
933
970
  WlcmSelectComponent,
934
971
  WlcmLabelComponent, WlcmInputDirective,
@@ -937,6 +974,7 @@ class WlcmFormsModule {
937
974
  WlcmFormFieldPrefixDirective,
938
975
  WlcmFormFieldHintDirective, MatRadioModule], exports: [WlcmFormFieldComponent,
939
976
  WlcmAutocompleteComponent,
977
+ WlcmAutocompleteSuffixComponent,
940
978
  WlcmCheckboxComponent,
941
979
  WlcmSelectComponent,
942
980
  WlcmLabelComponent, WlcmInputDirective,
@@ -959,5 +997,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
959
997
  * Generated bundle index. Do not edit.
960
998
  */
961
999
 
962
- export { WLCM_ERRORS, WLCM_FORM, WLCM_FORM_CONTROL, WLCM_FORM_CONTROL_PROVIDER, WLCM_FORM_FIELD, WLCM_FORM_FIELD_INPUT_CLASS, WLCM_FORM_PROVIDER, WLCM_INPUT, WLCM_INPUT_BINDER, WLCM_MAPS_API_ERROR, WLCM_PRIORITY_ERRORS, WLCM_SELECT_CONFIG, WlcmAutocompleteComponent, WlcmCheckboxComponent, WlcmErrorComponent, WlcmFormFieldComponent, WlcmFormFieldCustomContainerDirective, WlcmFormFieldHintDirective, WlcmFormFieldPrefixDirective, WlcmFormFieldSuffixDirective, WlcmFormsModule, WlcmInputDirective, WlcmLabelComponent, WlcmPlacesApi, WlcmSelectComponent, WlcmSelectInputBinderDirective };
1000
+ export { WLCM_ERRORS, WLCM_FORM, WLCM_FORM_CONTROL, WLCM_FORM_CONTROL_PROVIDER, WLCM_FORM_FIELD, WLCM_FORM_FIELD_INPUT_CLASS, WLCM_FORM_PROVIDER, WLCM_INPUT, WLCM_INPUT_BINDER, WLCM_MAPS_API_ERROR, WLCM_PRIORITY_ERRORS, WLCM_SELECT_CONFIG, WlcmAutocomplete, WlcmAutocompleteComponent, WlcmAutocompleteSuffixComponent, WlcmCheckboxComponent, WlcmErrorComponent, WlcmFormFieldComponent, WlcmFormFieldCustomContainerDirective, WlcmFormFieldHintDirective, WlcmFormFieldPrefixDirective, WlcmFormFieldSuffixDirective, WlcmFormsModule, WlcmInputDirective, WlcmLabelComponent, WlcmPlacesApi, WlcmSelectComponent, WlcmSelectInputBinderDirective };
963
1001
  //# sourceMappingURL=wlcm-angular-forms.mjs.map