@indice/ng-components 0.5.0 → 0.5.1-beta.1
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 = 300;
|
|
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,9 @@ 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.executeSearch(searchText);
|
|
4462
|
+
});
|
|
4454
4463
|
// disabled external route changes monitoring due to sync issues - which is bad :) - refresh from url will not work
|
|
4455
4464
|
// until i come up with a solution...
|
|
4456
4465
|
this.routeSub$ = this.route$.queryParamMap.subscribe(params => {
|
|
@@ -4615,6 +4624,9 @@ class BaseListComponent {
|
|
|
4615
4624
|
this.load();
|
|
4616
4625
|
}
|
|
4617
4626
|
searchChanged(searchText) {
|
|
4627
|
+
this.searchSubject$.next(searchText);
|
|
4628
|
+
}
|
|
4629
|
+
executeSearch(searchText) {
|
|
4618
4630
|
this.count = 0;
|
|
4619
4631
|
this.page = 1;
|
|
4620
4632
|
this.items = null;
|