@snabcentr/client-ui 1.9.2 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { EventEmitter, Component, ChangeDetectionStrategy, Inject, Input, Output, SkipSelf, inject, Directive, HostBinding, ContentChild, ViewChild, NgModule, ContentChildren, HostListener, Renderer2, ElementRef, Pipe, Optional, Injectable, ChangeDetectorRef, Self, forwardRef, InjectionToken } from '@angular/core';
3
3
  import * as i1 from '@snabcentr/client-core';
4
- import { ScUserMetrikaGoalsEnum, ScISuggestionType, ScOpfList, ScWarehouseService, ScAuthService, SEARCH_TERM, ScUnitsHelper, ScImageHelper, SC_PATH_IMAGE_NOT_FOUND, ScPhoneService, IS_RUNNING_ON_TERMINAL, SC_URLS, TERMINAL_PROVIDERS, SEARCH_TERM_PROVIDERS, ScPaginationService, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PRODUCT_PAGINATION_OPTIONS, ScIconTypesEnum, ScUserService } from '@snabcentr/client-core';
4
+ import { ScUserMetrikaGoalsEnum, ScISuggestionType, SC_MIN_LENGTH_SEARCH_TERM, ScOpfList, ScWarehouseService, ScAuthService, SEARCH_TERM, ScUnitsHelper, ScImageHelper, SC_PATH_IMAGE_NOT_FOUND, ScPhoneService, IS_RUNNING_ON_TERMINAL, SC_URLS, TERMINAL_PROVIDERS, SEARCH_TERM_PROVIDERS, ScPaginationService, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PRODUCT_PAGINATION_OPTIONS, ScIconTypesEnum, ScUserService } from '@snabcentr/client-core';
5
5
  import * as i6$2 from 'rxjs';
6
6
  import { Subject, map, filter, switchMap, tap, catchError, of, finalize, startWith, share, timer, scan, takeWhile, endWith, distinctUntilChanged, combineLatest, debounceTime, throwError, shareReplay, interval, takeUntil, skip } from 'rxjs';
7
7
  import * as i2 from '@angular/common';
@@ -678,10 +678,14 @@ class ScSuggestionFieldComponent {
678
678
  this.host = inject(TUI_DATA_LIST_HOST, {
679
679
  optional: true,
680
680
  });
681
+ /**
682
+ * Минимальная длина поискового запроса для получения данных.
683
+ */
684
+ this.minLengthSearchTerm = inject(SC_MIN_LENGTH_SEARCH_TERM);
681
685
  }
682
686
  /** @inheritDoc */
683
687
  ngOnInit() {
684
- const request$ = tuiControlValue(this.control).pipe(debounceTime(500), filter(tuiIsPresent), map((term) => term.trim()), filter((term) => term.length >= 3), switchMap((term) => this.suggestionService.getData(term, this.type).pipe(startWith(null))), catchError((error) => {
688
+ const request$ = tuiControlValue(this.control).pipe(debounceTime(500), filter(tuiIsPresent), map((term) => term.trim()), filter((term) => term.length >= this.minLengthSearchTerm), switchMap((term) => this.suggestionService.getData(term, this.type).pipe(startWith(null))), catchError((error) => {
685
689
  if (error instanceof HttpErrorResponse) {
686
690
  const errorResponse = error.error;
687
691
  if (this.control.control) {