@3kles/kles-material-dynamicforms 14.0.12 → 14.0.14

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.
@@ -1019,7 +1019,8 @@ let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbs
1019
1019
  if (this.field.lazy) {
1020
1020
  this.isLoading = true;
1021
1021
  if (this.field.value) {
1022
- this.options$ = new BehaviorSubject(Array.isArray(this.field.value) ? this.field.value : [this.field.value]);
1022
+ this.options$ = new BehaviorSubject(Array.isArray(this.group.controls[this.field.name].value) ? this.group.controls[this.field.name].value
1023
+ : [this.group.controls[this.field.name].value]);
1023
1024
  this.isLoading = false;
1024
1025
  }
1025
1026
  else {
@@ -2272,8 +2273,8 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
2272
2273
  super.ngOnInit();
2273
2274
  if (this.field.lazy) {
2274
2275
  this.isLoading = true;
2275
- if (this.field.value) {
2276
- this.options$ = new BehaviorSubject(Array.isArray(this.field.value) ? this.field.value : [this.field.value]);
2276
+ if (this.group.controls[this.field.name].value) {
2277
+ this.options$ = new BehaviorSubject(Array.isArray(this.group.controls[this.field.name].value) ? this.group.controls[this.field.name].value : [this.group.controls[this.field.name].value]);
2277
2278
  this.isLoading = false;
2278
2279
  }
2279
2280
  else {
@@ -2336,22 +2337,24 @@ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
2336
2337
  return this.options$;
2337
2338
  }
2338
2339
  })).subscribe(this.optionsFiltered$);
2339
- this.group.controls[this.field.name]
2340
- .valueChanges.pipe(takeUntil(this._onDestroy), startWith(this.group.controls[this.field.name].value), switchMap(selected => {
2341
- return this.optionsFiltered$.pipe(map((options) => options?.filter((option) => !option?.disabled)), map(options => {
2342
- if (!selected) {
2343
- return false;
2344
- }
2345
- if (options.length < selected.length) {
2346
- return options.length > 0 && options.every(o => selected.includes(o));
2347
- }
2348
- else {
2349
- return options.length > 0 && options.length === selected.length && selected.every(s => options.includes(s));
2350
- }
2351
- }));
2352
- })).subscribe(isChecked => {
2353
- this.selectAllControl.setValue(isChecked);
2354
- });
2340
+ if (this.field.multiple) {
2341
+ this.group.controls[this.field.name]
2342
+ .valueChanges.pipe(takeUntil(this._onDestroy), startWith(this.group.controls[this.field.name].value), switchMap(selected => {
2343
+ return this.optionsFiltered$.pipe(map((options) => options?.filter((option) => !option?.disabled)), map(options => {
2344
+ if (!selected) {
2345
+ return false;
2346
+ }
2347
+ if (options.length < selected.length) {
2348
+ return options.length > 0 && options.every(o => selected.includes(o));
2349
+ }
2350
+ else {
2351
+ return options.length > 0 && options.length === selected.length && selected.every(s => options.includes(s));
2352
+ }
2353
+ }));
2354
+ })).subscribe(isChecked => {
2355
+ this.selectAllControl.setValue(isChecked);
2356
+ });
2357
+ }
2355
2358
  }
2356
2359
  ngOnDestroy() {
2357
2360
  // this._onDestroy.next();