@indigina/kendo 2.0.31 → 2.0.32
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.
|
@@ -15,7 +15,7 @@ import * as i2$1 from '@progress/kendo-angular-inputs';
|
|
|
15
15
|
import { InputsModule } from '@progress/kendo-angular-inputs';
|
|
16
16
|
import * as i3$1 from '@progress/kendo-angular-label';
|
|
17
17
|
import { LabelModule } from '@progress/kendo-angular-label';
|
|
18
|
-
import { BehaviorSubject, Subject, of, throwError, map as map$1, from, tap as tap$1,
|
|
18
|
+
import { BehaviorSubject, Subject, of, throwError, map as map$1, from, tap as tap$1, switchMap, takeUntil } from 'rxjs';
|
|
19
19
|
import { map, mergeMap, debounceTime, catchError, tap, filter, take, finalize } from 'rxjs/operators';
|
|
20
20
|
import { toODataString, distinct, filterBy } from '@progress/kendo-data-query';
|
|
21
21
|
import * as i1$1 from 'ngx-toastr';
|
|
@@ -3302,12 +3302,27 @@ class FieldMultiSelectComponent extends FieldComponent {
|
|
|
3302
3302
|
this.autoClose = false;
|
|
3303
3303
|
this.changed = new EventEmitter();
|
|
3304
3304
|
this.destroy$ = new Subject();
|
|
3305
|
+
this.reload$ = new BehaviorSubject(undefined);
|
|
3305
3306
|
this.textField = this.textField ?? 'name';
|
|
3306
3307
|
this.valueField = this.valueField ?? 'id';
|
|
3307
3308
|
}
|
|
3308
3309
|
ngOnInit() {
|
|
3309
3310
|
super.ngOnInit();
|
|
3310
|
-
this.
|
|
3311
|
+
this.data$ = this.reload$.pipe(switchMap(() => this.loadData()), takeUntil(this.destroy$));
|
|
3312
|
+
}
|
|
3313
|
+
loadData() {
|
|
3314
|
+
if (this.data) {
|
|
3315
|
+
return of(this.data);
|
|
3316
|
+
}
|
|
3317
|
+
return this.getData().pipe(tap$1((page) => this.updateControlValue(page)), map$1((page) => page.data));
|
|
3318
|
+
}
|
|
3319
|
+
updateControlValue(page) {
|
|
3320
|
+
const data = page.data;
|
|
3321
|
+
const currentValue = this.control.value || [];
|
|
3322
|
+
const filteredValue = currentValue.filter((x) => data.some((d) => d.id === x));
|
|
3323
|
+
if (currentValue.length !== filteredValue.length) {
|
|
3324
|
+
this.control.setValue(filteredValue, { emitEvent: false });
|
|
3325
|
+
}
|
|
3311
3326
|
}
|
|
3312
3327
|
ngOnChanges() {
|
|
3313
3328
|
super.ngOnChanges();
|
|
@@ -3318,16 +3333,7 @@ class FieldMultiSelectComponent extends FieldComponent {
|
|
|
3318
3333
|
this.destroy$.complete();
|
|
3319
3334
|
}
|
|
3320
3335
|
setData() {
|
|
3321
|
-
|
|
3322
|
-
let dataSubject = new BehaviorSubject(this.data);
|
|
3323
|
-
this.data$ = dataSubject.asObservable();
|
|
3324
|
-
}
|
|
3325
|
-
else {
|
|
3326
|
-
this.data$ = this.getData().pipe(tap$1((page) => {
|
|
3327
|
-
let data = page.data;
|
|
3328
|
-
this.control.setValue(this.control.value.filter((x) => data.some((d) => d.id === x)));
|
|
3329
|
-
}), map$1((page) => page.data), takeUntil(this.destroy$));
|
|
3330
|
-
}
|
|
3336
|
+
this.reload$.next();
|
|
3331
3337
|
}
|
|
3332
3338
|
onPopupOpen(event) {
|
|
3333
3339
|
if (!this.singleMode) {
|