@3kles/kles-material-dynamicforms 14.0.10 → 14.0.12
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.component.mjs +43 -16
- package/esm2020/lib/fields/select.search.component.mjs +25 -15
- package/fesm2015/3kles-kles-material-dynamicforms.mjs +63 -26
- package/fesm2015/3kles-kles-material-dynamicforms.mjs.map +1 -1
- package/fesm2020/3kles-kles-material-dynamicforms.mjs +63 -26
- package/fesm2020/3kles-kles-material-dynamicforms.mjs.map +1 -1
- package/lib/fields/select.component.d.ts +2 -1
- package/lib/fields/select.search.component.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1006,6 +1006,7 @@ let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbs
|
|
|
1006
1006
|
this.viewRef = viewRef;
|
|
1007
1007
|
this.ref = ref;
|
|
1008
1008
|
this.isLoading = false;
|
|
1009
|
+
this.openChange$ = new Subject();
|
|
1009
1010
|
this.compareFn = (o1, o2) => {
|
|
1010
1011
|
if (this.field.property && o1 && o2) {
|
|
1011
1012
|
return o1[this.field.property] === o2[this.field.property];
|
|
@@ -1019,10 +1020,31 @@ let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbs
|
|
|
1019
1020
|
this.isLoading = true;
|
|
1020
1021
|
if (this.field.value) {
|
|
1021
1022
|
this.options$ = new BehaviorSubject(Array.isArray(this.field.value) ? this.field.value : [this.field.value]);
|
|
1023
|
+
this.isLoading = false;
|
|
1022
1024
|
}
|
|
1023
1025
|
else {
|
|
1024
1026
|
this.options$ = new BehaviorSubject([]);
|
|
1025
1027
|
}
|
|
1028
|
+
this.openChange$
|
|
1029
|
+
.pipe(takeUntil(this._onDestroy), switchMap((isOpen) => {
|
|
1030
|
+
if (isOpen) {
|
|
1031
|
+
if (!(this.field.options instanceof Observable)) {
|
|
1032
|
+
return of(this.field.options);
|
|
1033
|
+
}
|
|
1034
|
+
else {
|
|
1035
|
+
this.isLoading = true;
|
|
1036
|
+
return this.field.options.pipe(take(1));
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
else {
|
|
1040
|
+
return of(this.group.controls[this.field.name].value !== undefined ? [this.group.controls[this.field.name].value] : []);
|
|
1041
|
+
}
|
|
1042
|
+
}))
|
|
1043
|
+
.subscribe((options) => {
|
|
1044
|
+
this.options$.next(options);
|
|
1045
|
+
this.isLoading = false;
|
|
1046
|
+
this.ref.markForCheck();
|
|
1047
|
+
});
|
|
1026
1048
|
}
|
|
1027
1049
|
else {
|
|
1028
1050
|
if (!(this.field.options instanceof Observable)) {
|
|
@@ -1038,19 +1060,24 @@ let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbs
|
|
|
1038
1060
|
}
|
|
1039
1061
|
openChange($event) {
|
|
1040
1062
|
if (this.field.lazy) {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
}
|
|
1063
|
+
this.openChange$.next($event);
|
|
1064
|
+
// if ($event) {
|
|
1065
|
+
// if (!(this.field.options instanceof Observable)) {
|
|
1066
|
+
// (this.options$ as BehaviorSubject<any[]>).next(this.field.options);
|
|
1067
|
+
// } else {
|
|
1068
|
+
// this.isLoading = true;
|
|
1069
|
+
// this.field.options.pipe(take(1)).subscribe(options => {
|
|
1070
|
+
// (this.options$ as BehaviorSubject<any[]>).next(options);
|
|
1071
|
+
// this.isLoading = false;
|
|
1072
|
+
// this.ref.markForCheck();
|
|
1073
|
+
// });
|
|
1074
|
+
// }
|
|
1075
|
+
// } else {
|
|
1076
|
+
// (this.options$ as BehaviorSubject<any[]>)
|
|
1077
|
+
// .next(this.group.controls[this.field.name].value !== undefined ? [this.group.controls[this.field.name].value] : []);
|
|
1078
|
+
// this.ref.markForCheck();
|
|
1079
|
+
// // this.isLoading = true;
|
|
1080
|
+
// }
|
|
1054
1081
|
}
|
|
1055
1082
|
if (this.field.virtualScroll) {
|
|
1056
1083
|
if ($event) {
|
|
@@ -2233,6 +2260,7 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2233
2260
|
this.selectAllControl = new UntypedFormControl(false);
|
|
2234
2261
|
this.isLoading = false;
|
|
2235
2262
|
this.optionsFiltered$ = new ReplaySubject(1);
|
|
2263
|
+
this.openChange$ = new Subject();
|
|
2236
2264
|
this.compareFn = (o1, o2) => {
|
|
2237
2265
|
if (this.field.property && o1 && o2) {
|
|
2238
2266
|
return o1[this.field.property] === o2[this.field.property];
|
|
@@ -2246,10 +2274,31 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2246
2274
|
this.isLoading = true;
|
|
2247
2275
|
if (this.field.value) {
|
|
2248
2276
|
this.options$ = new BehaviorSubject(Array.isArray(this.field.value) ? this.field.value : [this.field.value]);
|
|
2277
|
+
this.isLoading = false;
|
|
2249
2278
|
}
|
|
2250
2279
|
else {
|
|
2251
2280
|
this.options$ = new BehaviorSubject([]);
|
|
2252
2281
|
}
|
|
2282
|
+
this.openChange$
|
|
2283
|
+
.pipe(takeUntil(this._onDestroy), switchMap((isOpen) => {
|
|
2284
|
+
if (isOpen) {
|
|
2285
|
+
if (!(this.field.options instanceof Observable)) {
|
|
2286
|
+
return of(this.field.options);
|
|
2287
|
+
}
|
|
2288
|
+
else {
|
|
2289
|
+
this.isLoading = true;
|
|
2290
|
+
return this.field.options.pipe(take(1));
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
else {
|
|
2294
|
+
return of(this.group.controls[this.field.name].value !== undefined ? [this.group.controls[this.field.name].value] : []);
|
|
2295
|
+
}
|
|
2296
|
+
}))
|
|
2297
|
+
.subscribe((options) => {
|
|
2298
|
+
this.options$.next(options);
|
|
2299
|
+
this.isLoading = false;
|
|
2300
|
+
this.ref.markForCheck();
|
|
2301
|
+
});
|
|
2253
2302
|
}
|
|
2254
2303
|
else {
|
|
2255
2304
|
if (!(this.field.options instanceof Observable)) {
|
|
@@ -2322,19 +2371,7 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
|
|
|
2322
2371
|
}
|
|
2323
2372
|
openChange($event) {
|
|
2324
2373
|
if (this.field.lazy) {
|
|
2325
|
-
|
|
2326
|
-
if (!(this.field.options instanceof Observable)) {
|
|
2327
|
-
this.options$.next(this.field.options);
|
|
2328
|
-
}
|
|
2329
|
-
else {
|
|
2330
|
-
this.isLoading = true;
|
|
2331
|
-
this.field.options.pipe(take(1)).subscribe(options => {
|
|
2332
|
-
this.options$.next(options);
|
|
2333
|
-
this.isLoading = false;
|
|
2334
|
-
this.ref.markForCheck();
|
|
2335
|
-
});
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2374
|
+
this.openChange$.next($event);
|
|
2338
2375
|
}
|
|
2339
2376
|
if (this.field.virtualScroll) {
|
|
2340
2377
|
if ($event) {
|