@indice/ng-components 0.5.0 → 0.5.1-beta.0

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.
@@ -4424,6 +4424,9 @@ class BaseListComponent {
4424
4424
  this.metaItems = [];
4425
4425
  this.singularResult = 'result';
4426
4426
  this.pluralResults = 'results';
4427
+ this.minimumSearchCharacters = 3;
4428
+ this.searchDebounceTime = 1000;
4429
+ this.searchSubject$ = new Subject();
4427
4430
  this.autoLoad = true;
4428
4431
  }
4429
4432
  ngOnDestroy() {
@@ -4433,6 +4436,9 @@ class BaseListComponent {
4433
4436
  if (this.loadSub$) {
4434
4437
  this.loadSub$.unsubscribe();
4435
4438
  }
4439
+ if (this.searchSub$) {
4440
+ this.searchSub$.unsubscribe();
4441
+ }
4436
4442
  }
4437
4443
  getViewActions() {
4438
4444
  const actions = [
@@ -4451,6 +4457,14 @@ class BaseListComponent {
4451
4457
  this.metaItems = [
4452
4458
  { key: 'count', icon: Icons.ItemsCount, text: 'please wait...' }
4453
4459
  ];
4460
+ this.searchSub$ = this.searchSubject$.pipe(filter(value => (value?.length ?? 0) >= this.minimumSearchCharacters || (value?.length ?? 0) === 0), debounceTime(this.searchDebounceTime), distinctUntilChanged()).subscribe(searchText => {
4461
+ this.count = 0;
4462
+ this.page = 1;
4463
+ this.items = null;
4464
+ this.search = searchText;
4465
+ this.setRouteParams();
4466
+ this.load();
4467
+ });
4454
4468
  // disabled external route changes monitoring due to sync issues - which is bad :) - refresh from url will not work
4455
4469
  // until i come up with a solution...
4456
4470
  this.routeSub$ = this.route$.queryParamMap.subscribe(params => {
@@ -4615,12 +4629,7 @@ class BaseListComponent {
4615
4629
  this.load();
4616
4630
  }
4617
4631
  searchChanged(searchText) {
4618
- this.count = 0;
4619
- this.page = 1;
4620
- this.items = null;
4621
- this.search = searchText;
4622
- this.setRouteParams();
4623
- this.load();
4632
+ this.searchSubject$.next(searchText);
4624
4633
  }
4625
4634
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: BaseListComponent, deps: [{ token: i1$1.ActivatedRoute }, { token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
4626
4635
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: BaseListComponent, isStandalone: false, selector: "ng-component", inputs: { autoLoad: ["auto-load", "autoLoad"] }, ngImport: i0, template: '', isInline: true }); }