@3kles/kles-material-dynamicforms 14.9.0 → 14.9.2
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/esm2020/lib/fields/select.lazy-search.component.mjs +2 -3
- package/esm2020/lib/fields/select.search.component.mjs +4 -3
- package/fesm2015/3kles-kles-material-dynamicforms.mjs +4 -4
- package/fesm2015/3kles-kles-material-dynamicforms.mjs.map +1 -1
- package/fesm2020/3kles-kles-material-dynamicforms.mjs +4 -4
- package/fesm2020/3kles-kles-material-dynamicforms.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { CommonModule } from '@angular/common';
|
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
6
|
import { FormControl, Validators, FormControlDirective, FormControlName, NG_VALUE_ACCESSOR, UntypedFormGroup, UntypedFormControl, FormArray, FormGroup, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
7
7
|
import { concat, of, Subject, Observable, BehaviorSubject, ReplaySubject } from 'rxjs';
|
|
8
|
-
import { take, catchError, map, takeUntil, startWith, switchMap } from 'rxjs/operators';
|
|
8
|
+
import { take, catchError, map, takeUntil, startWith, switchMap, debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
9
9
|
import * as i7$1 from '@angular/material/core';
|
|
10
10
|
import { MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule, MatOption, ErrorStateMatcher } from '@angular/material/core';
|
|
11
11
|
import * as i4 from '@angular/material/button';
|
|
@@ -2393,11 +2393,12 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2393
2393
|
this.options$ = of(this.field.options);
|
|
2394
2394
|
}
|
|
2395
2395
|
}
|
|
2396
|
-
this.searchControl.valueChanges.pipe(takeUntil(this._onDestroy), startWith(this.searchControl.value), switchMap(value => {
|
|
2396
|
+
this.searchControl.valueChanges.pipe(takeUntil(this._onDestroy), debounceTime(200), startWith(this.searchControl.value), distinctUntilChanged(), switchMap(value => {
|
|
2397
2397
|
return concat(of({ loading: true, options: [] }), this.onSearchChange(value).pipe(map((options) => ({ loading: false, options }))));
|
|
2398
2398
|
})).subscribe(({ loading, options }) => {
|
|
2399
2399
|
this.isLoading = loading;
|
|
2400
2400
|
this.optionsFiltered$.next(options);
|
|
2401
|
+
this.ref.markForCheck();
|
|
2401
2402
|
});
|
|
2402
2403
|
if (this.field.multiple) {
|
|
2403
2404
|
this.group.controls[this.field.name]
|
|
@@ -3133,8 +3134,7 @@ class KlesFormSelectLazySearchComponent extends KlesFormSelectSearchComponent {
|
|
|
3133
3134
|
onSearchChange(value) {
|
|
3134
3135
|
if (this.field.options instanceof Function) {
|
|
3135
3136
|
if (value) {
|
|
3136
|
-
|
|
3137
|
-
return this.field.options(search).pipe(take(1));
|
|
3137
|
+
return this.field.options(value).pipe(take(1));
|
|
3138
3138
|
}
|
|
3139
3139
|
else {
|
|
3140
3140
|
return this.field.options().pipe(take(1));
|